Class DeploymentUtil


  • public class DeploymentUtil
    extends Object
    Utility class for the deployment package.
    Since:
    6.0.0
    Version:
    $Revision: 23103 $ $Date: 2019-09-03 12:45:21 -0300 (Tue, 03 Sep 2019) $
    • Field Detail

      • PATTERN_INVALID_CHARACTERS_FILE_NAME

        public static final Pattern PATTERN_INVALID_CHARACTERS_FILE_NAME
        Pattern that determines whether the characters in the module id are invalid.
        Since:
        7.1.0
      • INSTALLED_MODULES_FOLDER

        public static final String INSTALLED_MODULES_FOLDER
        Folder that the modules files are stored.
        Since:
        7.1.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • DeploymentUtil

        public DeploymentUtil()
    • Method Detail

      • getComponentPathById

        public static String getComponentPathById​(String id)
        Returns the component path by it's id.
        Parameters:
        id - the component id.
        Returns:
        the component path.
        Since:
        7.1.0
      • getComponentPathById

        public static String getComponentPathById​(String id,
                                                  boolean withStartSlash)
        Returns the component path by it's id.
        Parameters:
        id - the component id.
        withStartSlash - indicates whether a start slash should be included.
        Returns:
        the component path.
        Since:
        7.1.0
      • getModuleDefinitionFromJarModule

        public static Document getModuleDefinitionFromJarModule​(File moduleFile)
                                                         throws SAXException,
                                                                IOException,
                                                                PortalException
        Returns the module descriptor for a module JAR file.
        Parameters:
        moduleFile - the module JAR file.
        Returns:
        the module descriptor XML document.
        Throws:
        SAXException - if any problem will be found in the component definition XML.
        IOException - if any error occurs during the file.
        PortalException - if any other error occurs during the process.
        Since:
        8.0.0
      • renameTempPortalFileToFinalModulePortalFile

        public static ClusterMirroredLocalDataFile renameTempPortalFileToFinalModulePortalFile​(LocalDataFile tempPortalFile)
                                                                                        throws PortalException,
                                                                                               IOException
        Renames the temp module file to the unique module file name. The correct module file name is the module identifier, defined inside the lumis-module.xml, together with the module version. The as the module identifier must be unique, the module file name will be the same of the module identifier.
        Parameters:
        tempPortalFile - the temp portal file to be renamed;
        Returns:
        the renamed portal file.
        Throws:
        PortalException
        IOException
        Since:
        8.0.0
      • getModuleFile

        public static File getModuleFile​(IModule module)
                                  throws PortalException
        Utility method to obtain an archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        6.0.0
      • getOldVersionModuleFile

        public static File getOldVersionModuleFile​(IModule module)
                                            throws PortalException
        Utility method to obtain the old version of the archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        7.1.0
      • getOldVersionModuleLocalDataFile

        public static LocalDataFile getOldVersionModuleLocalDataFile​(IModule module)
                                                              throws PortalException
        Utility method to obtain the old version of the archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        10.2.0
      • getOldVersionModuleRelativePath

        public static String getOldVersionModuleRelativePath​(IModule module)
        Returns the module's old version relative file path.
        Parameters:
        module - the module.
        Returns:
        the module's old version relative file path.
        Since:
        8.0.0
      • getNewVersionModuleFile

        public static File getNewVersionModuleFile​(IModule module)
                                            throws PortalException
        Utility method to obtain the new version of the archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        8.0.0
      • getNewVersionModuleLocalDataFile

        public static LocalDataFile getNewVersionModuleLocalDataFile​(IModule module)
                                                              throws PortalException
        Utility method to obtain the new version of the archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        10.2.0
      • getNewVersionModuleRelativePath

        public static String getNewVersionModuleRelativePath​(IModule module)
        Returns the module's new version relative file path.
        Parameters:
        module - the module.
        Returns:
        the module's new version relative file path.
        Since:
        8.0.0
      • getModuleFile

        public static File getModuleFile​(IModule module,
                                         ModuleType moduleType)
                                  throws PortalException
        Utility method to obtain an archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        8.0.0
      • getModuleLocalDataFile

        public static LocalDataFile getModuleLocalDataFile​(IModule module)
                                                    throws PortalException
        Utility method to obtain an archive file relative to a module.
        Parameters:
        module - the module.
        moduleType - the module type.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        10.2.0
      • getModuleLocalDataFile

        public static LocalDataFile getModuleLocalDataFile​(String moduleId)
                                                    throws PortalException
        Utility method to obtain an archive file relative to a module.
        Parameters:
        module - the module.
        Returns:
        the file.
        Throws:
        PortalException - if any error occurs during the process.
        Since:
        10.2.0
      • getModuleRelativePath

        public static String getModuleRelativePath​(IModule module)
        Returns the module's relative file path.
        Parameters:
        module - the module
        Returns:
        the module's relative file path.
        Since:
        8.0.0
      • getModuleRelativePath

        public static String getModuleRelativePath​(String moduleId)
        Returns the module's relative file path.
        Parameters:
        moduleId - the moduleId
        Returns:
        the module's relative file path.
        Since:
        8.0.0
      • getComponentFile

        public static File getComponentFile​(IComponent component)
                                     throws PortalException
        Utility method to obtain an archive file relative to a component.
        Parameters:
        component - the module identifier.
        Returns:
        the file.
        Throws:
        PortalException
        Since:
        7.1.0
      • getComponentFile

        public static File getComponentFile​(IComponent component,
                                            ComponentFolder folder)
                                     throws PortalException
        Returns the relative folder path within a component.
        Parameters:
        component - the component.
        folder - the desired folder type.
        Returns:
        the file.
        Throws:
        PortalException
        Since:
        7.1.0
      • copyPublicFiles

        public static void copyPublicFiles​(File portalFile,
                                           File baseFolder)
                                    throws PortalException,
                                           IOException
        Copies all public files from the given component public file path to each website.
        Parameters:
        portalFile - the folder to be processed.
        baseFolder - the base folder.
        Throws:
        PortalException - if any error occurs during the process.
        IOException
        Since:
        8.0.0
      • copyPublicFiles

        public static void copyPublicFiles​(File portalFile,
                                           File baseFolder,
                                           IWebsite website)
                                    throws PortalException,
                                           IOException
        Copies all public files from the given component public file path to the static directory of the given website.
        Parameters:
        portalFile - the folder to be processed.
        baseFolder - the base folder.
        webiste - the website.
        Throws:
        PortalException - if any error occurs during the process.
        IOException
        Since:
        11.0.0
      • deletePublicFiles

        public static void deletePublicFiles​(Set<String> componentPublicFilesPaths)
                                      throws PortalException
        Deletes the given files from public folder.
        Parameters:
        componentPublicFilesPaths - the files.
        Throws:
        PortalException
        Since:
        7.1.0
      • deletePublicFiles

        public static void deletePublicFiles​(Set<String> componentPublicFilesPaths,
                                             IWebsite website)
                                      throws PortalException
        Deletes the given files from public folder for the given website.
        Parameters:
        componentPublicFilesPaths - the files.
        website - the website
        Throws:
        PortalException
        Since:
        11.0.0
      • copyPublicFiles

        public static void copyPublicFiles​(String componentPublicFilesPath,
                                           JarFile moduleFile)
                                    throws PortalException,
                                           IOException
        Copies all public files from the given component public file path to each website.
        Parameters:
        componentPublicFilesPath - the base path of the component.
        portalFile - the component filePath.
        Throws:
        PortalException - if any error occurs during the process.
        IOException
        Since:
        7.1.0
      • copyPublicFiles

        public static void copyPublicFiles​(String componentPublicFilesPath,
                                           JarFile moduleFile,
                                           Collection<IWebsite> websites)
                                    throws PortalException,
                                           IOException
        Copies all public files from the given component public file path to the given website only.
        Parameters:
        componentPublicFilesPath - the base path of the component.
        portalFile - the component filePath.
        websites - the websites the files should be copied to.
        Throws:
        PortalException - if any error occurs during the process.
        IOException
        Since:
        11.0.0
      • copyJarsInPackageToDeploymentFolder

        public static void copyJarsInPackageToDeploymentFolder​(IFile rootFile)
                                                        throws IOException
        Copy recursively the files stored on the temp folder to the deployment final folder. This method uses the FileSystemManager to copy the files over the cluster environment.
        Parameters:
        rootFile - the package folder.
        Throws:
        IOException - if any error occurs during the process.
        Since:
        7.1.1
      • copyModuleToDeploymentFolder

        public static void copyModuleToDeploymentFolder​(IFile moduleFile,
                                                        String moduleId,
                                                        ModuleDiff diff)
                                                 throws IOException
        Copy recursively the files stored on the temp folder to the deployment final folder. This method uses the FileSystemManager to copy the files over the cluster environment.
        Parameters:
        moduleFile - the current portal file.
        moduleId - the module id.
        diff - files diff
        Throws:
        IOException - if any error occurs during the process.
        Since:
        7.1.1
      • getAllAvailableResources

        public static Set<String> getAllAvailableResources()
                                                    throws PortalException
        Returns all available resources of all deployed modules.
        Returns:
        all available resources of all deployed modules.
        Throws:
        PortalException
        Since:
        7.1.0
      • getResourcesOfModule

        public static Set<String> getResourcesOfModule​(IModule module)
                                                throws PortalException
        Returns all available resources of a given module.
        Parameters:
        module - the module.
        Returns:
        all available resources of a given module.
        Throws:
        PortalException
        Since:
        7.1.0
      • readAllStylesFromModule

        public static Collection<String> readAllStylesFromModule​(IModule module)
                                                          throws PortalException
        Returns all styles present in the given module.
        Parameters:
        module - the module.
        Returns:
        all styles present in the given module.
        Throws:
        PortalException
        Since:
        8.0.1
      • readAllStylesFromModule

        public static Collection<String> readAllStylesFromModule​(IModule module,
                                                                 File moduleFile)
                                                          throws PortalException
        Returns all styles present in the given module.
        Parameters:
        module - the module.
        moduleFile - the module file.
        Returns:
        all styles present in the given module.
        Throws:
        PortalException
        Since:
        8.0.1
      • clearStylesCache

        public static void clearStylesCache​(Collection<String> stylesPath)
                                     throws PortalException
        Clears the cache of the styles with the given paths.
        Parameters:
        stylesPath - the styles paths.
        Throws:
        PortalException
        Since:
        8.0.1