Package lumis.portal.deployment
Class DeploymentManager
- java.lang.Object
-
- lumis.portal.deployment.DeploymentManager
-
- All Implemented Interfaces:
IDeploymentManager
,IDeploymentManagerSPI
public class DeploymentManager extends java.lang.Object implements IDeploymentManagerSPI
Handles the deployment of portal resources.- Since:
- 4.0.7
- Version:
- $Revision: 25381 $ $Date: 2022-12-12 17:24:33 -0300 (Mon, 12 Dec 2022) $
-
-
Constructor Summary
Constructors Constructor Description DeploymentManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
changeComponentResolved(java.lang.String componentId, ITransaction transaction)
Changes the resolved value of the component based on the given component identifier.void
changeModuleResolved(java.lang.String moduleId, ITransaction transaction)
Changes the resolved value of the module based on the given module identifier.protected void
clearComponentChannel(IComponent component)
IDeploymentExecutionPlan
createModuleDeploymentExecutionPlan(IFile moduleFolder, boolean forceReprocess, boolean syncStructure)
Creates, validates and returns a module deployment execution plan.IDeploymentExecutionPlan
createModuleDeploymentExecutionPlan(IFile moduleFolder, boolean forceReprocess, boolean syncStructure, boolean wasClosedModule)
Creates, validates and returns a module deployment execution plan.IDeploymentExecutionPlan
createModuleDeploymentProcess(java.io.InputStream moduleArchive, boolean reprocessAllComponents)
Creates adeployment execution plan
for deploying the given module.IDeploymentExecutionPlan
createModuleUndeploymentProcess(java.util.List<IModule> modules)
Creates adeployment execution plan
for undeployment of the given modules.IDeploymentExecutionPlan
createPackageDeploymentProcess(java.io.File packageArchive, boolean reprocessAllComponents)
Creates adeployment execution plan
for deploying the given package.IDeploymentExecutionPlan
createPackageDeploymentProcess(java.io.File packageArchive, boolean reprocessAllComponents, boolean syncStructure)
Creates adeployment execution plan
for deploying the given package.void
deployModuleSource(IModule module)
Deploys the module passed as a parameter.void
deployModuleSource(IFile moduleFolder)
Deploys the module referenced in the File parametervoid
deployModuleSource(IFile moduleFolder, boolean syncStructure)
Deploys the module referenced in the File parametervoid
destroy()
Destroys the Deployment Manager.ModuleType
detectModuleType(java.io.InputStream moduleArchive)
Detects the module type of an archive, based on its contents.IComponent
getChannelComponent(java.lang.String channelId)
Returns the component associated to the channel.java.lang.Class<?>
getClass(java.lang.String className)
Deprecated.java.lang.ClassLoader
getClassLoader()
Returns a class loader that provides access to classes and resources in all deployed JAR modules and the portal.IComponent
getComponent(java.lang.String componentId)
Returns the component with the specified identifier.java.util.List<IComponent>
getComponents()
Returns the list of all installed components.java.lang.String
getLastDeployInstallationId()
Returns the last deployment installation identifier.IModule
getModule(java.lang.String moduleId)
Returns the module with the specified identifier.java.util.Collection<IModule>
getModules(ModuleType moduleType)
Returns the currently installed modules of the specified type.IPortalDeployer
getPortalDeployer(DeployConfig deployConfig)
Deprecated.java.lang.String
getResourceModuleId(java.lang.String resource)
Returns the module id for the given resourcejava.util.Set<java.lang.String>
getResources(java.net.URI basePath, boolean recursively, IResourceFilter resourceFilter)
Returns the available resources within the given base path.void
init()
Initializes the deployment manager.boolean
isInstallInProgress()
Returns whether a deploy installation is in progress.void
registerActivityStreamStructure()
Register activity-related structure.void
registerDeployer(IPortalDeployer deployer)
Deprecated.void
resetDeployment()
Resets the deployment status (and performs all required actions) to make a new deployment possible.
This method can make the portal unstable.java.lang.String
submit(IDeploymentExecutionPlan executionPlan)
Submits theexecution plan
created by this manager and returns the createdprocess
identifier.boolean
unregisterDeployer(IPortalDeployer deployer)
Deprecated.void
updateChannelId(java.lang.String componentId, java.lang.String channelId)
Updates the channelId of the given component.void
updateChannelId(java.lang.String componentId, java.lang.String channelId, boolean allowUpdateIfChannelBelongsToOtherComponent)
Updates the channelId of the given component.void
updateClassLoader(java.util.Collection<IModule> modulesToBeAdded, java.util.Collection<IModule> modulesToBeRemoved, ModuleDiff diff, boolean forceReprocess)
Updates the portal classloader over the cluster..
-
-
-
Method Detail
-
registerDeployer
@Deprecated public void registerDeployer(IPortalDeployer deployer)
Deprecated.Description copied from interface:IDeploymentManager
Register a deployer that may be used when performing a deployment.- Specified by:
registerDeployer
in interfaceIDeploymentManager
- Parameters:
deployer
- the deployer.
-
unregisterDeployer
@Deprecated public boolean unregisterDeployer(IPortalDeployer deployer)
Deprecated.Description copied from interface:IDeploymentManager
Unregisters a deployer that may be used when performing a deployment.- Specified by:
unregisterDeployer
in interfaceIDeploymentManager
- Parameters:
deployer
- the deployer.- Returns:
-
getPortalDeployer
@Deprecated public IPortalDeployer getPortalDeployer(DeployConfig deployConfig) throws PortalException
Deprecated.Description copied from interface:IDeploymentManager
Returns the deployer to be used to deploy to the portal.- Specified by:
getPortalDeployer
in interfaceIDeploymentManager
- Parameters:
deployConfig
- the deployment specification.- Returns:
- the deployer.
- Throws:
PortalException
- if there is no deployer that can handle the specified deployment.
-
init
public void init()
Initializes the deployment manager. This method initializes the deployed modules and starts the monitoring of deployments.- Since:
- 5.0.0
-
getClass
@Deprecated public java.lang.Class<?> getClass(java.lang.String className) throws java.lang.ClassNotFoundException
Deprecated.Description copied from interface:IDeploymentManager
Returns theClass
object associated with the class or interface with the given string name, within the deployed JAR library modules or the shared level class loader.- Specified by:
getClass
in interfaceIDeploymentManager
- Parameters:
className
- the fully qualified name of the desired class.- Returns:
- the
Class
object for the class with the specified name. - Throws:
java.lang.ClassNotFoundException
- if the class cannot be located.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:IDeploymentManager
Returns a class loader that provides access to classes and resources in all deployed JAR modules and the portal.When the returned class loader is used to obtain a class, the search is first done in the currently running modules and then in the portal main class loader.
When the returned class loader is used to obtain a resource, the search is first done in the
lumisdata/def
folder (for backwards compatibility), then in currently running modules and then in the portal main class loader.Main uses are:
ClassLoader.loadClass(String)
: for obtaining aClass
.ClassLoader.getResourceAsStream(String)
,ClassLoader.getResource(String)
orClassLoader.getResources(String)
: for accessing resources.
The returned instance must not be held for long as it may change between deploys. Instead obtain it again using this method.
- Specified by:
getClassLoader
in interfaceIDeploymentManager
- Returns:
- the class loader.
-
detectModuleType
public ModuleType detectModuleType(java.io.InputStream moduleArchive) throws java.io.IOException, IllegalModuleArchiveException
Description copied from interface:IDeploymentManager
Detects the module type of an archive, based on its contents.- Specified by:
detectModuleType
in interfaceIDeploymentManager
- Parameters:
moduleArchive
- the archive content input stream.- Returns:
- the module type.
- Throws:
java.io.IOException
- if an I/O error occurs.IllegalModuleArchiveException
- if the archive module type could not be recognized.
-
getModules
public java.util.Collection<IModule> getModules(ModuleType moduleType) throws PortalException
Description copied from interface:IDeploymentManager
Returns the currently installed modules of the specified type.- Specified by:
getModules
in interfaceIDeploymentManager
- Parameters:
moduleType
- the module type.- Returns:
- the modules.
- Throws:
PortalException
-
getModule
public IModule getModule(java.lang.String moduleId) throws PortalException
Description copied from interface:IDeploymentManager
Returns the module with the specified identifier.- Specified by:
getModule
in interfaceIDeploymentManager
- Parameters:
moduleId
- the module identifier.- Returns:
- the module.
- Throws:
PortalObjectNotFoundException
- if no module with the given identifier was found.PortalException
-
createModuleDeploymentProcess
public IDeploymentExecutionPlan createModuleDeploymentProcess(java.io.InputStream moduleArchive, boolean reprocessAllComponents) throws IllegalModuleArchiveException, PortalException
Description copied from interface:IDeploymentManager
Creates adeployment execution plan
for deploying the given module. The returnedProcess
is not yet ready to be executed.- Specified by:
createModuleDeploymentProcess
in interfaceIDeploymentManager
- Parameters:
moduleArchive
- the module archive input stream.reprocessAllComponents
- indicates if all components present in the module must be reprocessed.- Returns:
- the deployment plan.
- Throws:
IllegalModuleArchiveException
- if the given archive is not a valid module archive.PortalException
- See Also:
IDeploymentManager.submit(IDeploymentExecutionPlan)
-
createPackageDeploymentProcess
public IDeploymentExecutionPlan createPackageDeploymentProcess(java.io.File packageArchive, boolean reprocessAllComponents) throws IllegalPackageArchiveException, PortalException
Description copied from interface:IDeploymentManager
Creates adeployment execution plan
for deploying the given package.- Specified by:
createPackageDeploymentProcess
in interfaceIDeploymentManager
- Parameters:
packageArchive
- the package file.reprocessAllComponents
- indicates if all components present in the package must be reprocessed.- Returns:
- the deployment plan.
- Throws:
IllegalPackageArchiveException
- if the given archive is not a valid package archive.PortalException
- See Also:
IDeploymentManager.submit(IDeploymentExecutionPlan)
-
createPackageDeploymentProcess
public IDeploymentExecutionPlan createPackageDeploymentProcess(java.io.File packageArchive, boolean reprocessAllComponents, boolean syncStructure) throws IllegalPackageArchiveException, PortalException
Description copied from interface:IDeploymentManagerSPI
Creates adeployment execution plan
for deploying the given package.- Specified by:
createPackageDeploymentProcess
in interfaceIDeploymentManagerSPI
- Parameters:
packageArchive
- the package file.reprocessAllComponents
- indicates if all components present in the package must be reprocessed.syncStructure
- indicates whether the components structures will be synchronized if modified.- Returns:
- the deployment plan.
- Throws:
IllegalPackageArchiveException
- if the given archive is not a valid package archive.PortalException
- See Also:
IDeploymentManager.submit(IDeploymentExecutionPlan)
-
createModuleUndeploymentProcess
public IDeploymentExecutionPlan createModuleUndeploymentProcess(java.util.List<IModule> modules) throws PortalException
Description copied from interface:IDeploymentManager
Creates adeployment execution plan
for undeployment of the given modules.- Specified by:
createModuleUndeploymentProcess
in interfaceIDeploymentManager
- Parameters:
modules
- the modules to be undeployed.- Returns:
- the deployment plan.
- Throws:
PortalException
- See Also:
IDeploymentManager.submit(IDeploymentExecutionPlan)
-
submit
public java.lang.String submit(IDeploymentExecutionPlan executionPlan) throws PortalException
Description copied from interface:IDeploymentManager
Submits theexecution plan
created by this manager and returns the createdprocess
identifier.- Specified by:
submit
in interfaceIDeploymentManager
- Parameters:
executionPlan
- the execution plan.- Returns:
- the
process
identifier. - Throws:
PortalException
-
getLastDeployInstallationId
public java.lang.String getLastDeployInstallationId() throws PortalException
Description copied from interface:IDeploymentManagerSPI
Returns the last deployment installation identifier.- Specified by:
getLastDeployInstallationId
in interfaceIDeploymentManagerSPI
- Returns:
- the last deployment installation identifier or
null
if there is no information about last deployment. - Throws:
PortalException
- if any error occurs during the process.
-
isInstallInProgress
public boolean isInstallInProgress() throws PortalException
Description copied from interface:IDeploymentManagerSPI
Returns whether a deploy installation is in progress.- Specified by:
isInstallInProgress
in interfaceIDeploymentManagerSPI
- Returns:
- true if a deploy installation is in progress and false otherwise.
- Throws:
PortalException
- if any error occurs during the process.
-
getComponents
public java.util.List<IComponent> getComponents() throws PortalException
Description copied from interface:IDeploymentManagerSPI
Returns the list of all installed components.- Specified by:
getComponents
in interfaceIDeploymentManagerSPI
- Returns:
- the list of all installed components.
- Throws:
PortalException
- if any error occurs during the process.
-
getComponent
public IComponent getComponent(java.lang.String componentId) throws PortalException
Description copied from interface:IDeploymentManager
Returns the component with the specified identifier.- Specified by:
getComponent
in interfaceIDeploymentManager
- Parameters:
componentId
- the component identifier.- Returns:
- the component.
- Throws:
PortalObjectNotFoundException
- if no component with the given identifier was found.PortalException
-
changeComponentResolved
public void changeComponentResolved(java.lang.String componentId, ITransaction transaction) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Changes the resolved value of the component based on the given component identifier. If the current value is true, calling this method the current value will be changed to false. And if the current value is false, calling this method the current value will be changed to true.- Specified by:
changeComponentResolved
in interfaceIDeploymentManagerSPI
- Parameters:
componentId
- the component identifier to be changes the signal value.transaction
- the transaction to be used to change the component signal value.- Throws:
PortalException
- if any error occurs during the process.PortalObjectNotFoundException
- if the component cannot be located.
-
changeModuleResolved
public void changeModuleResolved(java.lang.String moduleId, ITransaction transaction) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Changes the resolved value of the module based on the given module identifier. If the current value is true, calling this method the current value will be changed to false. And if the current value is false, calling this method the current value will be changed to true.- Specified by:
changeModuleResolved
in interfaceIDeploymentManagerSPI
- Parameters:
moduleId
- the module identifier to be changes the signal value.transaction
- the transaction to be used to change the module signal value.- Throws:
PortalException
- if any error occurs during the process.PortalObjectNotFoundException
- if the module cannot be located.
-
updateChannelId
public void updateChannelId(java.lang.String componentId, java.lang.String channelId) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Updates the channelId of the given component. If the channelId parameter is assigned to another component, aPortalException
will be raised.- Specified by:
updateChannelId
in interfaceIDeploymentManagerSPI
- Parameters:
componentId
- the component identifier to be updated.channelId
- the channelId to be assigned.- Throws:
PortalException
- if any error occurs during the process.
-
getChannelComponent
public IComponent getChannelComponent(java.lang.String channelId) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Returns the component associated to the channel.- Specified by:
getChannelComponent
in interfaceIDeploymentManagerSPI
- Parameters:
channelId
- the channel of the component searching for.- Returns:
- the component object or null if none found.
- Throws:
PortalException
-
updateChannelId
public void updateChannelId(java.lang.String componentId, java.lang.String channelId, boolean allowUpdateIfChannelBelongsToOtherComponent) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Updates the channelId of the given component. If the channelId parameter is assigned to another component, aPortalException
will be raised only if allowUpdateIfChannelBelongsToOtherComponent is set to false.- Specified by:
updateChannelId
in interfaceIDeploymentManagerSPI
- Parameters:
componentId
- the component identifier to be updated.channelId
- the channelId to be assigned.allowUpdateIfChannelBelongsToOtherComponent
- true if the update is to be performed even if there is another component associated to the channel. In this case, that component will no longer be associated with the channel.- Throws:
PortalException
- if any error occurs during the process.
-
clearComponentChannel
protected void clearComponentChannel(IComponent component) throws java.io.IOException
- Throws:
java.io.IOException
-
createModuleDeploymentExecutionPlan
public IDeploymentExecutionPlan createModuleDeploymentExecutionPlan(IFile moduleFolder, boolean forceReprocess, boolean syncStructure) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Creates, validates and returns a module deployment execution plan.- Specified by:
createModuleDeploymentExecutionPlan
in interfaceIDeploymentManagerSPI
- Parameters:
moduleFolder
- the folder that corresponds to the module root.forceReprocess
- indicates if must reprocess the module and its components.syncStructure
- indicates whether the components structures will be synchronized if modified.- Returns:
- a validated deployment execution plan.
- Throws:
PortalException
- if any error occurs during the process.
-
createModuleDeploymentExecutionPlan
public IDeploymentExecutionPlan createModuleDeploymentExecutionPlan(IFile moduleFolder, boolean forceReprocess, boolean syncStructure, boolean wasClosedModule) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Creates, validates and returns a module deployment execution plan.- Specified by:
createModuleDeploymentExecutionPlan
in interfaceIDeploymentManagerSPI
- Parameters:
moduleFolder
- the folder that corresponds to the module root.forceReprocess
- indicates if must reprocess the module and its components.syncStructure
- indicates whether the components structures will be synchronized if modified.wasClosedModule
- Indicates whether the given module was closed before calling this method.- Returns:
- a validated deployment execution plan.
- Throws:
PortalException
- if any error occurs during the process.
-
deployModuleSource
public void deployModuleSource(IModule module) throws PortalException
Deploys the module passed as a parameter. The module must have a source directory specified.- Specified by:
deployModuleSource
in interfaceIDeploymentManagerSPI
- Parameters:
module
- the module that needs to be deployed.- Throws:
PortalException
-
deployModuleSource
public void deployModuleSource(IFile moduleFolder) throws PortalException
Deploys the module referenced in the File parameter- Specified by:
deployModuleSource
in interfaceIDeploymentManagerSPI
- Throws:
PortalException
-
deployModuleSource
public void deployModuleSource(IFile moduleFolder, boolean syncStructure) throws PortalException
Deploys the module referenced in the File parameter- Specified by:
deployModuleSource
in interfaceIDeploymentManagerSPI
- Parameters:
moduleFolder
- the source folder of module that needs to be deployed.syncStructure
- true if structure should be synchronized- Throws:
PortalException
-
getResourceModuleId
public java.lang.String getResourceModuleId(java.lang.String resource) throws PortalException
Returns the module id for the given resource- Specified by:
getResourceModuleId
in interfaceIDeploymentManagerSPI
- Returns:
- Throws:
PortalException
-
getResources
public java.util.Set<java.lang.String> getResources(java.net.URI basePath, boolean recursively, IResourceFilter resourceFilter) throws PortalException
Description copied from interface:IDeploymentManagerSPI
Returns the available resources within the given base path.It is important to notice that the given base path must include a
scheme
, which will be used to decide how and where the resources will be searched.- Specified by:
getResources
in interfaceIDeploymentManagerSPI
- Parameters:
basePath
- the base path to be used as root of search.recursively
- indicates whether the search will be recursive.resourceFilter
- optional resource filter to limit the resources returned.- Returns:
- the available resources within the given base path.
- Throws:
PortalException
-
resetDeployment
public void resetDeployment() throws PortalException
Description copied from interface:IDeploymentManagerSPI
Resets the deployment status (and performs all required actions) to make a new deployment possible.
This method can make the portal unstable. USE WITH CAUTION!- Specified by:
resetDeployment
in interfaceIDeploymentManagerSPI
- Throws:
PortalException
-
updateClassLoader
public void updateClassLoader(java.util.Collection<IModule> modulesToBeAdded, java.util.Collection<IModule> modulesToBeRemoved, ModuleDiff diff, boolean forceReprocess) throws PortalException, java.io.IOException
Updates the portal classloader over the cluster..- Parameters:
modulesToBeAdded
- the modules to be added in portal classloader.modulesToBeRemoved
- the modules to be removed from portal classloader.diff
- the module diff.forceReprocess
- indicates if reprocessing should be forced.- Throws:
PortalException
java.io.IOException
- Since:
- 10.2.0
-
destroy
public void destroy()
Description copied from interface:IDeploymentManagerSPI
Destroys the Deployment Manager.- Specified by:
destroy
in interfaceIDeploymentManagerSPI
-
registerActivityStreamStructure
public void registerActivityStreamStructure() throws PortalException
Register activity-related structure.- Throws:
PortalException
- Since:
- 10.3.0
-
-