Class OpenCmsModulePackager

java.lang.Object
com.mediaworx.opencms.moduleutils.packager.OpenCmsModulePackager

public class OpenCmsModulePackager extends Object
Packs module resources and the module's manifest.xml into an OpenCms module zip file.
  • Constructor Details

    • OpenCmsModulePackager

      public OpenCmsModulePackager()
      creates a new module packager that can be used to pack module resources and the module's manifest.xml into an OpenCms module zip file
  • Method Details

    • packageModule

      public String packageModule(String manifestRootPath, String vfsRootPath, String moduleZipTargetFolder) throws OpenCmsModulePackagerException
      Creates the zip file for the module described in the manifest file at the given manifestRootPath. The VFS files are retrieved from the given vfsRootPath. The resulting zip file is placed at the given moduleZipTargetFolder.
      Parameters:
      manifestRootPath - path containing the module's manifest xml file (parent folder without the manifest's file name)
      vfsRootPath - root path under which the VFS files to be packaged are stored
      moduleZipTargetFolder - target folder where the module zip is to be placed
      Returns:
      the file name of the created module zip (containing the version), e.g. com.mycompany.mypackege.mymodule_1.0.zip
      Throws:
      OpenCmsModulePackagerException - thrown in case of any error (e.g. xml parse exception, file write exception). The exception's message contains detailed information about what went wrong.
    • packageModule

      public String packageModule(String manifestRootPath, String vfsRootPath, String moduleZipTargetFolder, String moduleVersion) throws OpenCmsModulePackagerException
      Creates the zip file for the module described in the manifest file at the given manifestRootPath. The VFS files are retrieved from the given vfsRootPath. The resulting zip file is placed at the given moduleZipTargetFolder.
      Parameters:
      manifestRootPath - path containing the module's manifest xml file (parent folder without the manifest's file name)
      vfsRootPath - root path under which the VFS files to be packaged are stored
      moduleZipTargetFolder - target folder where the module zip is to be placed
      moduleVersion - module version to be used (overrides the module version in the manifest file), may be null (then the module version from the manifest file is used). If provided, the syntax must match [0-9]+(\.[0-9]+)? (e.g. "1" or "1.2"). Any String not matching this syntax will be replaced by "1.0".
      Returns:
      the file name of the created module zip (containing the version), e.g. com.mycompany.mypackege.mymodule_1.4.zip
      Throws:
      OpenCmsModulePackagerException - thrown in case of any error (e.g. xml parse exception, file write exception). The exception's message contains detailed information about what went wrong.