public class DeploymentUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
INSTALLED_MODULES_FOLDER
Folder that the modules files are stored.
|
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 and Description |
---|
DeploymentUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
calculateComponentChecksumInExplodedDir(File componentDirectory,
File moduleDirectory)
Calculates a checksum for the specified component.
|
static String |
calculateComponentChecksumInJar(File moduleJarFile,
String componentId)
Calculates a checksum for the specified component.
|
static String |
calculateModuleChecksum(File moduleFile)
Calculates a checksum for a module.
|
static void |
copyJarsInPackageToDeploymentFolder(String tempFolderPath,
PortalFile rootFile,
String finalLocationFolderPath)
Copy recursively the files stored on the temp folder to the deployment final folder.
|
static void |
copyModuleToDeploymentFolder(String tempFolderPath,
File moduleFile,
String finalLocationFolderPath)
Copy recursively the files stored on the temp folder to the deployment final folder.
|
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,
PortalFile portalFile)
Copies all public files from the given component public file path to each website.
|
static void |
deletePublicFiles(Set<String> componentPublicFilesPaths)
Deletes the given files from public folder.
|
static void |
deletePublicFiles(String componentPublicFilesPath,
JarFile moduleFile)
Deletes all public files from the given component public file path for each website.
|
static void |
deletePublicFiles(String componentPublicFilesPath,
PortalFile portalFile)
Deletes all public files from the given component public file path for each website.
|
static Set<String> |
getAllAvailableResources()
Returns all available resources of all deployed modules.
|
static Document |
getComponentDefinitionFromJarModule(File moduleFile,
String componentId)
Returns the component definition from a given componentId.
|
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 List<File> |
getDeployFiles(String fileExtension)
Utility method to list all files available to be deployed.
|
static File |
getModuleFile(IModule module)
Utility method to obtain an archive file relative to a module.
|
static File |
getModuleFile(String moduleId,
ModuleType moduleType)
Utility method to obtain an archive file relative to a module.
|
static File |
getOldVersionModuleFile(IModule module)
Utility method to obtain the old version of the archive file relative to a module.
|
static Set<String> |
getResourcesOfModule(IModule module)
Returns all available resources of a given module.
|
static boolean |
renameFile(File src,
File dest)
Tries to rename a file to another.
|
static PortalFile |
renameTempPortalFileToFinalModulePortalFile(PortalFile tempPortalFile)
Renames the temp module file to the unique module file name.
|
public static final Pattern PATTERN_INVALID_CHARACTERS_FILE_NAME
public static final String META_INF_LUMIS_PACKAGE_NAME
public static final String META_INF_LUMIS_PACKAGE_XML
public static final String INSTALLED_MODULES_FOLDER
public static final String TEMP_JAR_MODULE_SUFIX
public static final String TO_BE_DELETE_JAR_MODULE_SUFIX
public static String getComponentPathById(String id)
id
- the component id.public static String getComponentPathById(String id, boolean withStartSlash)
id
- the component id.withStartSlash
- indicates whether a start slash should be included.public static Document getComponentDefinitionFromJarModule(File moduleFile, String componentId) throws SAXException, IOException, PortalException
moduleFile
- the module file where the component definition will be read.componentId
- the component identifier.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.public static PortalFile renameTempPortalFileToFinalModulePortalFile(PortalFile tempPortalFile) throws PortalException, IOException
tempPortalFile
- the temp portal file to be renamed;PortalException
IOException
public static File getModuleFile(IModule module) throws PortalException
module
- the module.moduleType
- the module type.PortalException
- if any error occurs during the process.public static File getOldVersionModuleFile(IModule module) throws PortalException
module
- the module.moduleType
- the module type.PortalException
- if any error occurs during the process.public static File getModuleFile(String moduleId, ModuleType moduleType) throws PortalException
moduleId
- the module identifier.moduleType
- the module type.PortalException
- if any error occurs during the process.public static File getComponentFile(IComponent component) throws PortalException
component
- the module identifier.PortalException
public static File getComponentFile(IComponent component, ComponentFolder folder) throws PortalException
component
- the component.folder
- the desired folder type.PortalException
public static List<File> getDeployFiles(String fileExtension)
fileExtension
- type of files to be considered. May be .zip or .jar.public static String calculateModuleChecksum(File moduleFile) throws IOException
moduleFile
- the module JAR or exploded directory.IOException
- if an error occurred while reading the file.public static String calculateComponentChecksumInJar(File moduleJarFile, String componentId) throws IOException
moduleJarFile
- the module JAR file.componentId
- component identifier.IOException
- if an error occurred while reading the file.public static String calculateComponentChecksumInExplodedDir(File componentDirectory, File moduleDirectory) throws IOException
componentDirectory
- the directory that contains the
component's componentdefinition.xml file.moduleDirectory
- the component's module directory.IOException
- if an error occurred while reading the file.public static void deletePublicFiles(String componentPublicFilesPath, PortalFile portalFile) throws PortalException
componentPublicFilesPath
- the base path of the component.portalFile
- the component filePath.PortalException
- if any error occurs during the process.public static void copyPublicFiles(String componentPublicFilesPath, PortalFile portalFile) throws PortalException, IOException
componentPublicFilesPath
- the base path of the component.portalFile
- the component filePath.PortalException
- if any error occurs during the process.IOException
public static void deletePublicFiles(String componentPublicFilesPath, JarFile moduleFile) throws PortalException
componentPublicFilesPath
- the base path of the component.portalFile
- the component filePath.PortalException
- if any error occurs during the process.public static void deletePublicFiles(Set<String> componentPublicFilesPaths) throws PortalException
componentPublicFilesPaths
- the files.PortalException
public static void copyPublicFiles(String componentPublicFilesPath, JarFile moduleFile) throws PortalException, IOException
componentPublicFilesPath
- the base path of the component.portalFile
- the component filePath.PortalException
- if any error occurs during the process.IOException
public static void copyJarsInPackageToDeploymentFolder(String tempFolderPath, PortalFile rootFile, String finalLocationFolderPath) throws IOException
tempFolderPath
- the path of the temp folder where the files are stored.rootFile
- the current portal file.finalLocationFolderPath
- the complete path of the deployment final folder where the files will be stored.IOException
- if any error occurs during the process.public static void copyModuleToDeploymentFolder(String tempFolderPath, File moduleFile, String finalLocationFolderPath) throws IOException
tempFolderPath
- the path of the temp folder where the files are stored.moduleFile
- the current portal file.finalLocationFolderPath
- the complete path of the deployment final folder where the files will be stored.IOException
- if any error occurs during the process.public static Set<String> getAllAvailableResources() throws PortalException
PortalException
public static Set<String> getResourcesOfModule(IModule module) throws PortalException
module
- the module.PortalException
Lumisportal 7.1.1.140331 - Copyright © 2006–2014 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.