Package lumis.portal.deployment
Class DeploymentUtil
- java.lang.Object
-
- lumis.portal.deployment.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) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DeploymentUtil.ComponentDeploymentMessageSummary
Creates a summary about the deployment process for the componentstatic class
DeploymentUtil.DeploymentMessageSummary<T extends lumis.portal.deployment.DeploymentMessage,O>
Abstract class for deployment message summary.static class
DeploymentUtil.ModuleDeploymentMessageSummary
Creates a summary about the deployment process for the module
-
Field Summary
Fields Modifier and Type Field Description static String
DEPLOY_FOLDER_NAME
static String
INSTALLED_MODULES_FOLDER
Folder that the modules files are stored.static String
META_INF_LUMIS_MODULE_XML
static String
META_INF_LUMIS_PACKAGE_NAME
static String
META_INF_LUMIS_PACKAGE_XML
static Pattern
PATTERN_INVALID_CHARACTERS_FILE_NAME
Pattern that determines whether the characters in the module id are invalid.static String
TEMP_JAR_MODULE_SUFIX
static String
TO_BE_DELETE_JAR_MODULE_SUFIX
-
Constructor Summary
Constructors Constructor Description DeploymentUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearStylesCache(Collection<String> stylesPath)
Clears the cache of the styles with the given paths.static void
copyJarsInPackageToDeploymentFolder(IFile rootFile)
Copy recursively the files stored on the temp folder to the deployment final folder.static void
copyModuleToDeploymentFolder(IFile moduleFile, String moduleId, ModuleDiff diff)
Copy recursively the files stored on the temp folder to the deployment final folder.static void
copyPublicFiles(File portalFile, File baseFolder)
Copies all public files from the given component public file path to each website.static void
copyPublicFiles(File portalFile, File baseFolder, IWebsite website)
Copies all public files from the given component public file path to the static directory of the given website.static void
copyPublicFiles(String componentPublicFilesPath, JarFile moduleFile)
Copies all public files from the given component public file path to each website.static void
copyPublicFiles(String componentPublicFilesPath, JarFile moduleFile, Collection<IWebsite> websites)
Copies all public files from the given component public file path to the given website only.static void
createChannelComponent(String name, String channelId, String exportToPath, IModule module, IFile componentDefinitionFile, ITransaction transaction)
static void
deletePublicFiles(Set<String> componentPublicFilesPaths)
Deletes the given files from public folder.static void
deletePublicFiles(Set<String> componentPublicFilesPaths, IWebsite website)
Deletes the given files from public folder for the given website.static Set<String>
getAllAvailableResources()
Returns all available resources of all deployed modules.static File
getComponentFile(IComponent component)
Utility method to obtain an archive file relative to a component.static File
getComponentFile(IComponent component, ComponentFolder folder)
Returns the relative folder path within a component.static String
getComponentPathById(String id)
Returns the component path by it's id.static String
getComponentPathById(String id, boolean withStartSlash)
Returns the component path by it's id.static Document
getModuleDefinitionFromJarModule(File moduleFile)
Returns the module descriptor for a module JAR file.static File
getModuleFile(IModule module)
Utility method to obtain an archive file relative to a module.static File
getModuleFile(IModule module, ModuleType moduleType)
Utility method to obtain an archive file relative to a module.static LocalDataFile
getModuleLocalDataFile(String moduleId)
Utility method to obtain an archive file relative to a module.static LocalDataFile
getModuleLocalDataFile(IModule module)
Utility method to obtain an archive file relative to a module.static String
getModuleRelativePath(String moduleId)
Returns the module's relative file path.static String
getModuleRelativePath(IModule module)
Returns the module's relative file path.static File
getNewVersionModuleFile(IModule module)
Utility method to obtain the new version of the archive file relative to a module.static LocalDataFile
getNewVersionModuleLocalDataFile(IModule module)
Utility method to obtain the new version of the archive file relative to a module.static String
getNewVersionModuleRelativePath(IModule module)
Returns the module's new version relative file path.static File
getOldVersionModuleFile(IModule module)
Utility method to obtain the old version of the archive file relative to a module.static LocalDataFile
getOldVersionModuleLocalDataFile(IModule module)
Utility method to obtain the old version of the archive file relative to a module.static String
getOldVersionModuleRelativePath(IModule module)
Returns the module's old version relative file path.static Set<String>
getResourcesOfModule(IModule module)
Returns all available resources of a given module.static Collection<String>
readAllStylesFromModule(IModule module)
Returns all styles present in the given module.static Collection<String>
readAllStylesFromModule(IModule module, File moduleFile)
Returns all styles present in the given module.static ClusterMirroredLocalDataFile
renameTempPortalFileToFinalModulePortalFile(LocalDataFile tempPortalFile)
Renames the temp module file to the unique module file name.
-
-
-
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
-
META_INF_LUMIS_PACKAGE_NAME
public static final String META_INF_LUMIS_PACKAGE_NAME
- See Also:
- Constant Field Values
-
META_INF_LUMIS_PACKAGE_XML
public static final String META_INF_LUMIS_PACKAGE_XML
- See Also:
- Constant Field Values
-
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
-
DEPLOY_FOLDER_NAME
public static final String DEPLOY_FOLDER_NAME
- See Also:
- Constant Field Values
-
TEMP_JAR_MODULE_SUFIX
public static final String TEMP_JAR_MODULE_SUFIX
- See Also:
- Constant Field Values
-
TO_BE_DELETE_JAR_MODULE_SUFIX
public static final String TO_BE_DELETE_JAR_MODULE_SUFIX
- See Also:
- Constant Field Values
-
META_INF_LUMIS_MODULE_XML
public static final String META_INF_LUMIS_MODULE_XML
- See Also:
- Constant Field Values
-
-
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
-
createChannelComponent
public static void createChannelComponent(String name, String channelId, String exportToPath, IModule module, IFile componentDefinitionFile, ITransaction transaction) throws UnexpectedException, PortalException, IOException
-
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
-
-