public class JahiaTemplateManagerService extends JahiaService implements org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, JahiaAfterInitializationService
| Modifier and Type | Class and Description |
|---|---|
static class |
JahiaTemplateManagerService.ModuleDependenciesEvent
Is fired when the module dependencies are changed.
|
static class |
JahiaTemplateManagerService.ModuleDeployedOnSiteEvent
Event indicates that a module was either installed to the specified site or uninstalled from it.
|
static class |
JahiaTemplateManagerService.TemplatePackageRedeployedEvent
This event is fired when a template module is re-deployed (in runtime, not on the server startup).
|
| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
DEFAULT_MODULES_WITH_NO_DEFAUL_DEPENDENCY |
static String |
MODULE_TYPE_MODULE |
static String |
MODULE_TYPE_SYSTEM |
static String |
MODULE_TYPE_TEMPLATES_SET |
static Comparator<JahiaTemplatesPackage> |
TEMPLATE_PACKAGE_NAME_COMPARATOR |
settingsBean| Constructor and Description |
|---|
JahiaTemplateManagerService() |
| Modifier and Type | Method and Description |
|---|---|
JahiaTemplatesPackage |
activateModuleVersion(String moduleId,
String version) |
void |
autoInstallModulesToSites(JahiaTemplatesPackage module,
JCRSessionWrapper session) |
boolean |
checkExistingContent(String module)
Check if any content is created with definitions in this module
|
JCRNodeWrapper |
checkoutModule(File moduleSources,
String scmURI,
String branchOrTag,
String moduleId,
String version,
JCRSessionWrapper session)
Checkout module sources, compile and deploy
|
File |
checkoutTempModule(String scmURI,
String branchOrTag,
String moduleId,
String version) |
boolean |
checkValidSources(JahiaTemplatesPackage pack,
File sources) |
JahiaTemplatesPackage |
compileAndDeploy(String moduleId,
File sources,
JCRSessionWrapper session) |
File |
compileModule(File sources) |
JCRNodeWrapper |
createModule(String moduleName,
String artifactId,
String groupId,
String moduleType,
File sources,
JCRSessionWrapper session) |
JahiaTemplatesPackage |
deployModule(File warFile,
JCRSessionWrapper session) |
void |
deployToMaven(String groupId,
String artifactId,
ModuleReleaseInfo releaseInfo,
File generatedWar) |
boolean |
differentModuleWithSameIdExists(String symbolicName,
String groupId) |
JahiaTemplatesPackage |
duplicateModule(String moduleName,
String moduleId,
String groupId,
String srcPath,
String scmURI,
String branchOrTag,
String srcModuleId,
String srcModuleVersion,
boolean uninstallSrcModule,
String dstPath,
boolean deleteSrcFolder,
JCRSessionWrapper session) |
void |
fireTemplatePackageRedeployedEvent(JahiaTemplatesPackage aPackage)
Fires a Spring event in core context and contexts of all modules to notify listeners about the fact that a module bundle is either
started or stopped.
|
Map<String,Action> |
getActions() |
JahiaTemplatesPackage |
getAnyDeployedTemplatePackage(String templatePackage) |
List<JahiaTemplatesPackage> |
getAvailableTemplatePackages()
Returns a list of all available template packages.
|
int |
getAvailableTemplatePackagesCount()
Returns the number of available template packages in the registry.
|
Map<String,BackgroundAction> |
getBackgroundActions() |
List<ErrorHandler> |
getErrorHandler() |
Set<org.osgi.framework.Bundle> |
getInitializedBundles() |
Set<org.osgi.framework.Bundle> |
getInstalledBundles() |
List<JahiaTemplatesPackage> |
getInstalledModulesForSite(String siteKey,
boolean includeTemplateSet,
boolean includeDirectDependencies,
boolean includeTransitiveDependencies)
get List of installed modules for a site.
|
Set<String> |
getKnownFragmentHosts()
Returns a set of symbolic names for bundles, which are known to be target hosts for fragments.
|
List<org.osgi.framework.Bundle> |
getModulesByState(ModuleState.State state)
Returns list of module bundles in the specified state.
|
Map<org.osgi.framework.Bundle,ModuleState> |
getModuleStates() |
Set<String> |
getModulesWithNoDefaultDependency() |
Set<JahiaTemplatesPackage> |
getModulesWithViewsForComponent(String componentName)
Returns a set of all available template packages having templates for a module.
|
List<String> |
getNonManageableModules() |
List<JahiaTemplatesPackage> |
getNonSystemModulePackages() |
List<JahiaTemplatesPackage> |
getNonSystemTemplateSetPackages() |
Map<org.osgi.framework.Bundle,JahiaTemplatesPackage> |
getRegisteredBundles() |
List<RenderFilter> |
getRenderFilters()
Returns a list of
RenderFilter instances, configured for the specified templates package. |
SourceControlFactory |
getSourceControlFactory() |
File |
getSources(JahiaTemplatesPackage pack,
JCRSessionWrapper session) |
JahiaTemplatesPackage |
getTemplatePackage(String packageName)
Returns the requested template package for the specified site or
null if the package with the specified name is not
registered in the repository. |
JahiaTemplatesPackage |
getTemplatePackageByFileName(String fileName)
Deprecated.
use
getTemplatePackageById(String) instead |
JahiaTemplatesPackage |
getTemplatePackageById(String moduleId)
Returns the requested template package for the specified site or
null if the package with the specified Id is not
registered in the repository. |
Map<String,JahiaTemplatesPackage> |
getTemplatePackageByNodeName()
Returns the lookup map for template packages by the JCR node name.
|
TemplatePackageDeployer |
getTemplatePackageDeployer() |
TemplatePackageRegistry |
getTemplatePackageRegistry() |
Set<String> |
getTemplateSetNames()
Returns a set of existing template sets that are available for site creation.
|
Map<String,List<org.osgi.framework.Bundle>> |
getToBeResolved() |
String |
guessBranchOrTag(String moduleVersion,
String scm,
Set<String> branchOrTags) |
boolean |
hasEncounteredIssuesWithDefinitions()
Indicates if any issue related to the definitions has been encountered since the last startup.
|
void |
initAfterAllServicesAreStarted() |
JCRNodeWrapper |
installFromSources(File sources,
JCRSessionWrapper session) |
void |
installModule(JahiaTemplatesPackage module,
String sitePath,
JCRSessionWrapper session) |
void |
installModule(String moduleId,
String sitePath,
String username) |
void |
installModule(String moduleId,
String version,
String sitePath,
String username) |
void |
installModuleOnAllSites(JahiaTemplatesPackage module,
JCRSessionWrapper sessionWrapper,
List<JCRNodeWrapper> sites)
Install module in provided list of site
|
void |
installModules(List<JahiaTemplatesPackage> modules,
String sitePath,
JCRSessionWrapper session) |
boolean |
isTemplatePresent(String templateName,
Set<String> templateSetNames)
Checks if the specified template is available either in one of the requested template sets or modules.
|
boolean |
isTemplatePresent(String templateName,
String templateSetName)
Checks if the specified template is available either in the requested template set or in one of the deployed modules.
|
Map<String,String> |
listBranches(String scmURI) |
Map<String,String> |
listTags(String scmURI) |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
List<File> |
regenerateImportFile(String moduleId,
File sources,
JCRSessionWrapper session) |
File |
releaseModule(JahiaTemplatesPackage module,
ModuleReleaseInfo releaseInfo,
File sources,
String scmUrl,
JCRSessionWrapper session) |
File |
releaseModule(String moduleId,
ModuleReleaseInfo releaseInfo,
JCRSessionWrapper session) |
void |
sendToSourceControl(String moduleId,
String scmURI,
String scmType,
JCRSessionWrapper session) |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
void |
setForgeHelper(org.jahia.services.templates.ForgeHelper forgeHelper)
Injects an instance of the helper class for Private App Store related operations.
|
void |
setKnownFragmentHosts(Set<String> knownFragmentHosts)
Defines a set of symbolic names for bundles, which are known to be target hosts for fragments.
|
void |
setModuleBuildHelper(ModuleBuildHelper moduleBuildHelper) |
void |
setModuleInstallationHelper(ModuleInstallationHelper moduleInstallationHelper) |
void |
setModuleManager(ModuleManager moduleManager) |
void |
setModuleStates(Map<org.osgi.framework.Bundle,ModuleState> moduleStates) |
void |
setModulesWithNoDefaultDependency(Set<String> modulesWithNoDefaultDependency) |
void |
setNonManageableModules(List<String> nonManageableModules) |
void |
setSiteService(JahiaSitesService siteService) |
void |
setSourceControlHelper(SourceControlHelper scmHelper)
Injects an instance of the SCM helper.
|
void |
setSourcesFolderInPackage(JahiaTemplatesPackage pack,
File sources) |
void |
setTemplatePackageDeployer(TemplatePackageDeployer deployer) |
void |
setTemplatePackageRegistry(TemplatePackageRegistry registry) |
void |
setXmlIndentation(int i) |
void |
start() |
void |
stop() |
JahiaTemplatesPackage |
stopModule(String moduleId) |
void |
synchro(JCRNodeWrapper source,
JCRNodeWrapper destinationNode,
JCRSessionWrapper session,
String moduleName,
Map<String,List<String>> references) |
void |
templatesSynchro(JCRNodeWrapper source,
JCRNodeWrapper destinationNode,
JCRSessionWrapper session,
Map<String,List<String>> references,
boolean doUpdate,
boolean doChildren) |
void |
undeployModule(JahiaTemplatesPackage pack) |
void |
undeployModule(String moduleId,
String version) |
void |
uninstallModule(JahiaTemplatesPackage module,
String sitePath,
JCRSessionWrapper session) |
void |
uninstallModule(String module,
String sitePath,
String username,
boolean purgeAllContent) |
void |
uninstallModules(List<JahiaTemplatesPackage> modules,
String sitePath,
JCRSessionWrapper session) |
void |
uninstallModulesByIds(List<String> moduleIds,
String sitePath,
JCRSessionWrapper session) |
void |
uninstallModulesFromAllSites(List<String> modules,
JCRSessionWrapper session) |
void |
uninstallModulesFromAllSites(String module,
JCRSessionWrapper session) |
void |
uninstallModulesFromAllSites(String module,
String username,
boolean purgeAllContent) |
void |
updateDependencies(JahiaTemplatesPackage pack,
List<String> depends) |
getSettingsBean, setSettingsBeanpublic static final Set<String> DEFAULT_MODULES_WITH_NO_DEFAUL_DEPENDENCY
public static final String MODULE_TYPE_MODULE
public static final String MODULE_TYPE_SYSTEM
public static final String MODULE_TYPE_TEMPLATES_SET
public static final Comparator<JahiaTemplatesPackage> TEMPLATE_PACKAGE_NAME_COMPARATOR
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic void setSiteService(JahiaSitesService siteService)
public void setTemplatePackageRegistry(TemplatePackageRegistry registry)
public void setTemplatePackageDeployer(TemplatePackageDeployer deployer)
public TemplatePackageDeployer getTemplatePackageDeployer()
public TemplatePackageRegistry getTemplatePackageRegistry()
public SourceControlFactory getSourceControlFactory()
public void setXmlIndentation(int i)
public void start()
throws JahiaInitializationException
start in class JahiaServiceJahiaInitializationExceptionpublic void stop()
throws JahiaException
stop in class JahiaServiceJahiaExceptionpublic void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>public JCRNodeWrapper checkoutModule(File moduleSources, String scmURI, String branchOrTag, String moduleId, String version, JCRSessionWrapper session) throws IOException, javax.jcr.RepositoryException, org.osgi.framework.BundleException
moduleSources - sources folderscmURI - scm uri ( in mvn format , scm:branchOrTag - branch or tagmoduleId - name of the module to checkout, if there are multiple modules in the repositoryversion - version of the module to checkout, if there are multiple modules in the repositorysession - sessionIOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorsorg.osgi.framework.BundleExceptionpublic File checkoutTempModule(String scmURI, String branchOrTag, String moduleId, String version) throws javax.jcr.RepositoryException, org.codehaus.plexus.util.xml.pull.XmlPullParserException, org.dom4j.DocumentException, IOException
javax.jcr.RepositoryExceptionorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionorg.dom4j.DocumentExceptionIOExceptionpublic JahiaTemplatesPackage duplicateModule(String moduleName, String moduleId, String groupId, String srcPath, String scmURI, String branchOrTag, String srcModuleId, String srcModuleVersion, boolean uninstallSrcModule, String dstPath, boolean deleteSrcFolder, JCRSessionWrapper session) throws IOException, javax.jcr.RepositoryException, org.osgi.framework.BundleException
IOExceptionjavax.jcr.RepositoryExceptionorg.osgi.framework.BundleExceptionpublic JCRNodeWrapper createModule(String moduleName, String artifactId, String groupId, String moduleType, File sources, JCRSessionWrapper session) throws IOException, javax.jcr.RepositoryException, org.osgi.framework.BundleException
IOExceptionjavax.jcr.RepositoryExceptionorg.osgi.framework.BundleExceptionpublic JahiaTemplatesPackage deployModule(File warFile, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic JahiaTemplatesPackage compileAndDeploy(String moduleId, File sources, JCRSessionWrapper session) throws javax.jcr.RepositoryException, IOException, org.osgi.framework.BundleException
javax.jcr.RepositoryExceptionIOExceptionorg.osgi.framework.BundleExceptionpublic File compileModule(File sources) throws IOException
IOExceptionpublic JCRNodeWrapper installFromSources(File sources, JCRSessionWrapper session) throws IOException, javax.jcr.RepositoryException, org.osgi.framework.BundleException
IOExceptionjavax.jcr.RepositoryExceptionorg.osgi.framework.BundleExceptionpublic File getSources(JahiaTemplatesPackage pack, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void sendToSourceControl(String moduleId, String scmURI, String scmType, JCRSessionWrapper session) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryExceptionIOExceptionpublic Map<String,String> listTags(String scmURI) throws IOException
IOExceptionpublic Map<String,String> listBranches(String scmURI) throws IOException
IOExceptionpublic String guessBranchOrTag(String moduleVersion, String scm, Set<String> branchOrTags)
public boolean checkValidSources(JahiaTemplatesPackage pack, File sources)
public File releaseModule(String moduleId, ModuleReleaseInfo releaseInfo, JCRSessionWrapper session) throws javax.jcr.RepositoryException, IOException, org.osgi.framework.BundleException
javax.jcr.RepositoryExceptionIOExceptionorg.osgi.framework.BundleExceptionpublic File releaseModule(JahiaTemplatesPackage module, ModuleReleaseInfo releaseInfo, File sources, String scmUrl, JCRSessionWrapper session) throws javax.jcr.RepositoryException, IOException, org.osgi.framework.BundleException
javax.jcr.RepositoryExceptionIOExceptionorg.osgi.framework.BundleExceptionpublic void deployToMaven(String groupId, String artifactId, ModuleReleaseInfo releaseInfo, File generatedWar) throws IOException
IOExceptionpublic List<File> regenerateImportFile(String moduleId, File sources, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void updateDependencies(JahiaTemplatesPackage pack, List<String> depends)
public void fireTemplatePackageRedeployedEvent(JahiaTemplatesPackage aPackage)
aPackage - the module that generated this eventpublic void setSourcesFolderInPackage(JahiaTemplatesPackage pack, File sources)
public List<JahiaTemplatesPackage> getInstalledModulesForSite(String siteKey, boolean includeTemplateSet, boolean includeDirectDependencies, boolean includeTransitiveDependencies) throws JahiaException
siteKey - key of the siteincludeTemplateSet - if true (default is false) include dependencies of the template setincludeDirectDependencies - if true (default is false) include dependencies of dependenciesincludeTransitiveDependencies - if true (default is false) include all dependenciesJahiaExceptionpublic void autoInstallModulesToSites(JahiaTemplatesPackage module, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void installModuleOnAllSites(JahiaTemplatesPackage module, JCRSessionWrapper sessionWrapper, List<JCRNodeWrapper> sites) throws javax.jcr.RepositoryException
module - : module to installsessionWrapper - : session to usesites - : list of sites on which deploy the modulejavax.jcr.RepositoryException - in case of JCR-related errorspublic void installModule(String moduleId, String sitePath, String username) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void installModule(String moduleId, String version, String sitePath, String username) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void installModule(JahiaTemplatesPackage module, String sitePath, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void installModules(List<JahiaTemplatesPackage> modules, String sitePath, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void synchro(JCRNodeWrapper source, JCRNodeWrapper destinationNode, JCRSessionWrapper session, String moduleName, Map<String,List<String>> references) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void templatesSynchro(JCRNodeWrapper source, JCRNodeWrapper destinationNode, JCRSessionWrapper session, Map<String,List<String>> references, boolean doUpdate, boolean doChildren) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModule(String module, String sitePath, String username, boolean purgeAllContent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModule(JahiaTemplatesPackage module, String sitePath, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModules(List<JahiaTemplatesPackage> modules, String sitePath, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModulesByIds(List<String> moduleIds, String sitePath, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModulesFromAllSites(String module, String username, boolean purgeAllContent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModulesFromAllSites(String module, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void uninstallModulesFromAllSites(List<String> modules, JCRSessionWrapper session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic boolean checkExistingContent(String module) throws javax.jcr.RepositoryException
module - javax.jcr.RepositoryException - in case of JCR-related errorspublic List<JahiaTemplatesPackage> getAvailableTemplatePackages()
public List<JahiaTemplatesPackage> getNonSystemTemplateSetPackages()
public List<JahiaTemplatesPackage> getNonSystemModulePackages()
public int getAvailableTemplatePackagesCount()
public Map<String,BackgroundAction> getBackgroundActions()
public List<ErrorHandler> getErrorHandler()
public JahiaTemplatesPackage getTemplatePackageByFileName(String fileName)
getTemplatePackageById(String) insteadnull if the package with the specified fileName is not
registered in the repository.fileName - the template package fileName to search fornull if the
package with the specified name is not registered in the
repositorypublic JahiaTemplatesPackage getTemplatePackageById(String moduleId)
null if the package with the specified Id is not
registered in the repository.moduleId - the template package Id to search fornull if the
package with the specified Id is not registered in the
repositorypublic List<RenderFilter> getRenderFilters()
RenderFilter instances, configured for the specified templates package.RenderFilter instances, configured for the specified templates packagepublic Set<JahiaTemplatesPackage> getModulesWithViewsForComponent(String componentName)
public JahiaTemplatesPackage getTemplatePackage(String packageName)
null if the package with the specified name is not
registered in the repository.packageName - the template package name to search fornull if the
package with the specified name is not registered in the
repositorypublic Map<String,JahiaTemplatesPackage> getTemplatePackageByNodeName()
public JahiaTemplatesPackage getAnyDeployedTemplatePackage(String templatePackage)
public Set<String> getTemplateSetNames()
public JahiaTemplatesPackage activateModuleVersion(String moduleId, String version) throws javax.jcr.RepositoryException, org.osgi.framework.BundleException
javax.jcr.RepositoryExceptionorg.osgi.framework.BundleExceptionpublic JahiaTemplatesPackage stopModule(String moduleId) throws javax.jcr.RepositoryException, org.osgi.framework.BundleException
javax.jcr.RepositoryExceptionorg.osgi.framework.BundleExceptionpublic void undeployModule(String moduleId, String version) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void undeployModule(JahiaTemplatesPackage pack) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic boolean isTemplatePresent(String templateName, String templateSetName)
templateName - the path of the template to be checkedtemplateSetName - the name of the target template settrue if the specified template is present; false otherwisepublic boolean isTemplatePresent(String templateName, Set<String> templateSetNames)
templateName - the path of the template to be checkedtemplateSetNames - the set of template sets and modules we should check for the presence of the specified templatetrue if the specified template is present; false otherwisepublic Map<org.osgi.framework.Bundle,ModuleState> getModuleStates()
public Map<org.osgi.framework.Bundle,JahiaTemplatesPackage> getRegisteredBundles()
public Set<org.osgi.framework.Bundle> getInstalledBundles()
public Set<org.osgi.framework.Bundle> getInitializedBundles()
public List<org.osgi.framework.Bundle> getModulesByState(ModuleState.State state)
state - the state of the module to be consideredpublic void setModuleStates(Map<org.osgi.framework.Bundle,ModuleState> moduleStates)
public boolean differentModuleWithSameIdExists(String symbolicName, String groupId)
public void initAfterAllServicesAreStarted()
throws JahiaInitializationException
initAfterAllServicesAreStarted in interface JahiaAfterInitializationServiceJahiaInitializationExceptionpublic void setModuleInstallationHelper(ModuleInstallationHelper moduleInstallationHelper)
public final boolean hasEncounteredIssuesWithDefinitions()
public void setSourceControlHelper(SourceControlHelper scmHelper)
scmHelper - an instance of the SCM helperpublic void setModuleBuildHelper(ModuleBuildHelper moduleBuildHelper)
public void setForgeHelper(org.jahia.services.templates.ForgeHelper forgeHelper)
forgeHelper - an instance helper class for Private App Store related operationspublic void setModulesWithNoDefaultDependency(Set<String> modulesWithNoDefaultDependency)
public Set<String> getKnownFragmentHosts()
public void setKnownFragmentHosts(Set<String> knownFragmentHosts)
knownFragmentHosts - a set of symbolic names for bundles, which are known to be target hosts for fragmentspublic void setModuleManager(ModuleManager moduleManager)
Copyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.