Class CmsImportHelper

java.lang.Object
org.opencms.importexport.CmsImportHelper

public class CmsImportHelper extends Object
Import helper.

Since:
7.0.4
  • Constructor Details

  • Method Details

    • cacheDtdSystemId

      public void cacheDtdSystemId(String dtdSystemLocation, String dtdFilename, String dtdUrlPrefix)
      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

      public void closeFile()
      Closes the zip file.

    • getFileBytes

      public byte[] getFileBytes(String filename) throws CmsImportExportException
      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

      public long getFileModification(String filename) throws CmsImportExportException
      Throws:
      CmsImportExportException
    • getFileName

      public String 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

      public File getFolder()
      Returns the RFS folder to import from.

      Returns:
      the RFS folder to import from
    • getLocation

      public String getLocation(Class<?> clazz)
      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

      public ZipFile getZipFile()
      Returns the RFS zip file to import from.

      Returns:
      the RFS zip file to import from
    • openFile

      public void openFile() throws IOException
      Opens the import file.

      Throws:
      IOException - if the file could not be opened
    • getFile

      protected File getFile(String filename)
      Returns the file for the provided filename.
      Parameters:
      filename - name of the file
      Returns:
      the file.
    • getZipEntry

      protected ZipEntry getZipEntry(String filename) throws ZipException
      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