public class CmsImportHelper extends java.lang.Object
| Constructor and Description |
|---|
CmsImportHelper(CmsImportParameters parameters)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cacheDtdSystemId(java.lang.String dtdSystemLocation,
java.lang.String dtdFilename,
java.lang.String dtdUrlPrefix)
Adds a new DTD system id prefix mapping for internal resolution
of external URLs.
|
void |
closeFile()
Closes the zip file.
|
protected java.io.File |
getFile(java.lang.String filename)
Returns the file for the provided filename.
|
byte[] |
getFileBytes(java.lang.String filename)
Returns a byte array containing the content of the file.
|
long |
getFileModification(java.lang.String filename) |
java.lang.String |
getFileName()
Returns the name of the import file, without zip extension.
|
java.io.InputStream |
getFileStream(java.lang.String fileName)
Returns a stream for the content of the file.
|
java.io.File |
getFolder()
Returns the RFS folder to import from.
|
java.lang.String |
getLocation(java.lang.Class<?> clazz)
Returns the class system location.
|
protected java.util.zip.ZipEntry |
getZipEntry(java.lang.String filename)
Returns the zip entry for a file in the archive.
|
java.util.zip.ZipFile |
getZipFile()
Returns the RFS zip file to import from.
|
void |
openFile()
Opens the import file.
|
public CmsImportHelper(CmsImportParameters parameters)
parameters - the import parameters to usepublic void cacheDtdSystemId(java.lang.String dtdSystemLocation, java.lang.String dtdFilename, java.lang.String dtdUrlPrefix)
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.dtddtdUrlPrefix - the external system id prefix of the DTD file, e.g. http://www.opencms.org/dtd/6.0/I_CmsXmlConfigurationpublic void closeFile()
public byte[] getFileBytes(java.lang.String filename) throws CmsImportExportException
filename - the name of the file to read, relative to the folder or zip fileCmsImportExportException - if something goes wrongpublic long getFileModification(java.lang.String filename) throws CmsImportExportException
CmsImportExportExceptionpublic java.lang.String getFileName()
public java.io.InputStream getFileStream(java.lang.String fileName) throws CmsImportExportException
fileName - the name of the file to stream, relative to the folder or zip fileCmsImportExportException - if something goes wrongpublic java.io.File getFolder()
public java.lang.String getLocation(java.lang.Class<?> clazz)
i.e: org/opencms/importexport
clazz - the class to get the location forpublic java.util.zip.ZipFile getZipFile()
public void openFile() throws java.io.IOException
java.io.IOException - if the file could not be openedprotected java.io.File getFile(java.lang.String filename)
filename - name of the fileprotected java.util.zip.ZipEntry getZipEntry(java.lang.String filename) throws java.util.zip.ZipException
filename - the file namejava.util.zip.ZipException - thrown if the file is not in the zip archive