Package lumis.portal.deployment
Class DeploymentUtil
- java.lang.Object
-
- lumis.portal.deployment.DeploymentUtil
-
public class DeploymentUtil extends java.lang.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 java.lang.String
DEPLOY_FOLDER_NAME
static java.lang.String
INSTALLED_MODULES_FOLDER
Folder that the modules files are stored.static java.lang.String
META_INF_LUMIS_MODULE_XML
static java.lang.String
META_INF_LUMIS_PACKAGE_NAME
static java.lang.String
META_INF_LUMIS_PACKAGE_XML
static java.util.regex.Pattern
PATTERN_INVALID_CHARACTERS_FILE_NAME
Pattern that determines whether the characters in the module id are invalid.static java.lang.String
TEMP_JAR_MODULE_SUFIX
static java.lang.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(java.util.Collection<java.lang.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, java.lang.String moduleId, ModuleDiff diff)
Copy recursively the files stored on the temp folder to the deployment final folder.static void
copyPublicFiles(java.io.File portalFile, java.io.File baseFolder)
Copies all public files from the given component public file path to each website.static void
copyPublicFiles(java.io.File portalFile, java.io.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(java.lang.String componentPublicFilesPath, java.util.jar.JarFile moduleFile)
Copies all public files from the given component public file path to each website.static void
copyPublicFiles(java.lang.String componentPublicFilesPath, java.util.jar.JarFile moduleFile, java.util.Collection<IWebsite> websites)
Copies all public files from the given component public file path to the given website only.static void
createChannelComponent(java.lang.String name, java.lang.String channelId, java.lang.String exportToPath, IModule module, IFile componentDefinitionFile, ITransaction transaction)
static void
deletePublicFiles(java.util.Set<java.lang.String> componentPublicFilesPaths)
Deletes the given files from public folder.static void
deletePublicFiles(java.util.Set<java.lang.String> componentPublicFilesPaths, IWebsite website)
Deletes the given files from public folder for the given website.static java.util.Set<java.lang.String>
getAllAvailableResources()
Returns all available resources of all deployed modules.static java.io.File
getComponentFile(IComponent component)
Utility method to obtain an archive file relative to a component.static java.io.File
getComponentFile(IComponent component, ComponentFolder folder)
Returns the relative folder path within a component.static java.lang.String
getComponentPathById(java.lang.String id)
Returns the component path by it's id.static java.lang.String
getComponentPathById(java.lang.String id, boolean withStartSlash)
Returns the component path by it's id.static org.w3c.dom.Document
getModuleDefinitionFromJarModule(java.io.File moduleFile)
Returns the module descriptor for a module JAR file.static java.io.File
getModuleFile(IModule module)
Utility method to obtain an archive file relative to a module.static java.io.File
getModuleFile(IModule module, ModuleType moduleType)
Utility method to obtain an archive file relative to a module.static LocalDataFile
getModuleLocalDataFile(java.lang.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 java.lang.String
getModuleRelativePath(java.lang.String moduleId)
Returns the module's relative file path.static java.lang.String
getModuleRelativePath(IModule module)
Returns the module's relative file path.static java.io.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 java.lang.String
getNewVersionModuleRelativePath(IModule module)
Returns the module's new version relative file path.static java.io.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 java.lang.String
getOldVersionModuleRelativePath(IModule module)
Returns the module's old version relative file path.static java.util.Set<java.lang.String>
getResourcesOfModule(IModule module)
Returns all available resources of a given module.static java.util.Collection<java.lang.String>
readAllStylesFromModule(IModule module)
Returns all styles present in the given module.static java.util.Collection<java.lang.String>
readAllStylesFromModule(IModule module, java.io.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 java.util.regex.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 java.lang.String META_INF_LUMIS_PACKAGE_NAME
- See Also:
- Constant Field Values
-
META_INF_LUMIS_PACKAGE_XML
public static final java.lang.String META_INF_LUMIS_PACKAGE_XML
- See Also:
- Constant Field Values
-
INSTALLED_MODULES_FOLDER
public static final java.lang.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 java.lang.String DEPLOY_FOLDER_NAME
- See Also:
- Constant Field Values
-
TEMP_JAR_MODULE_SUFIX
public static final java.lang.String TEMP_JAR_MODULE_SUFIX
- See Also:
- Constant Field Values
-
TO_BE_DELETE_JAR_MODULE_SUFIX
public static final java.lang.String TO_BE_DELETE_JAR_MODULE_SUFIX
- See Also:
- Constant Field Values
-
META_INF_LUMIS_MODULE_XML
public static final java.lang.String META_INF_LUMIS_MODULE_XML
- See Also:
- Constant Field Values
-
-
Method Detail
-
getComponentPathById
public static java.lang.String getComponentPathById(java.lang.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 java.lang.String getComponentPathById(java.lang.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 org.w3c.dom.Document getModuleDefinitionFromJarModule(java.io.File moduleFile) throws org.xml.sax.SAXException, java.io.IOException, PortalException
Returns the module descriptor for a module JAR file.- Parameters:
moduleFile
- the module JAR file.- Returns:
- the module descriptor XML document.
- Throws:
org.xml.sax.SAXException
- if any problem will be found in the component definition XML.java.io.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, java.io.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
java.io.IOException
- Since:
- 8.0.0
-
getModuleFile
public static java.io.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 java.io.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 java.lang.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 java.io.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 java.lang.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 java.io.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(java.lang.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 java.lang.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 java.lang.String getModuleRelativePath(java.lang.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 java.io.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 java.io.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(java.io.File portalFile, java.io.File baseFolder) throws PortalException, java.io.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.java.io.IOException
- Since:
- 8.0.0
-
copyPublicFiles
public static void copyPublicFiles(java.io.File portalFile, java.io.File baseFolder, IWebsite website) throws PortalException, java.io.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.java.io.IOException
- Since:
- 11.0.0
-
deletePublicFiles
public static void deletePublicFiles(java.util.Set<java.lang.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(java.util.Set<java.lang.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(java.lang.String componentPublicFilesPath, java.util.jar.JarFile moduleFile) throws PortalException, java.io.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.java.io.IOException
- Since:
- 7.1.0
-
copyPublicFiles
public static void copyPublicFiles(java.lang.String componentPublicFilesPath, java.util.jar.JarFile moduleFile, java.util.Collection<IWebsite> websites) throws PortalException, java.io.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.java.io.IOException
- Since:
- 11.0.0
-
copyJarsInPackageToDeploymentFolder
public static void copyJarsInPackageToDeploymentFolder(IFile rootFile) throws java.io.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:
java.io.IOException
- if any error occurs during the process.- Since:
- 7.1.1
-
copyModuleToDeploymentFolder
public static void copyModuleToDeploymentFolder(IFile moduleFile, java.lang.String moduleId, ModuleDiff diff) throws java.io.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:
java.io.IOException
- if any error occurs during the process.- Since:
- 7.1.1
-
getAllAvailableResources
public static java.util.Set<java.lang.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 java.util.Set<java.lang.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(java.lang.String name, java.lang.String channelId, java.lang.String exportToPath, IModule module, IFile componentDefinitionFile, ITransaction transaction) throws UnexpectedException, PortalException, java.io.IOException
- Throws:
UnexpectedException
PortalException
java.io.IOException
-
readAllStylesFromModule
public static java.util.Collection<java.lang.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 java.util.Collection<java.lang.String> readAllStylesFromModule(IModule module, java.io.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(java.util.Collection<java.lang.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
-
-