private void addCancelButtonTextFieldToFormSubmitTemplate(DeltaBuilder delta) { final String parentPath = "/modules/form/dialogs/formSubmit/form/tabs/tabMain/fields"; String generalDescTxt = " an additional field 'cancelButtonLabel' to" + parentPath + "."; Task bootstrapSingleModuleResource = new BootstrapSingleModuleResource("Add" + generalDescTxt, "Adds" + generalDescTxt, "dialogs/config.modules.form.dialogs.formSubmit.yaml", "/formSubmit/form/tabs/tabMain/fields/cancelButtonText"); NodeExistsDelegateTask nodeExistsDelegateTask = new NodeExistsDelegateTask("Conditionally add" + generalDescTxt + "(If " + parentPath + " exists.)", parentPath, bootstrapSingleModuleResource); delta.addTask(nodeExistsDelegateTask); }
protected List<Task> getCommonTasks() { final List<Task> commonTasks = new ArrayList<>(); commonTasks.add(new IsInstallSamplesTask("Re-Bootstrap website content for sample pages", "Re-bootstrap website content to account for all changes", new ArrayDelegateTask("", new BootstrapSingleResource("", "", "/mgnl-bootstrap-samples/samples/website.ftl-sample-site.xml"), new BootstrapSingleResource("", "", "/mgnl-bootstrap-samples/samples/dam.samples.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))); // We re-bootstrap twice because a simple (and single) re-bootstrap (using ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) would NOT // "move" an existing site definition (which might actually exist from a previous version) in the site module commonTasks.add(new BootstrapSingleModuleResource("config.modules.samples.config.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)); commonTasks.add(new BootstrapSingleModuleResource("config.modules.samples.config.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)); return commonTasks; }
@Override protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { final Session session = installContext.getConfigJCRSession(); final String newCacheFactoryName = StringUtils.substringBefore(StringUtils.lowerCase(StringUtils.substringAfterLast(session.getNode("/modules/cache/config/cacheFactory/").getProperty("class").getString(), ".")), "factory"); new RenameNodeTask("", RepositoryConstants.CONFIG, "/modules/cache/config", "cacheFactory", newCacheFactoryName, false).execute(installContext); new BootstrapSingleModuleResource("config.modules.cache.config.cacheFactory.xml").execute(installContext); new MoveNodeTask("", "/modules/cache/config/" + newCacheFactoryName, "/modules/cache/config/cacheFactory/delegateFactories/" + newCacheFactoryName, false).execute(installContext); } }
@Test public void testAutogeneratedDescription() throws Exception { // GIVEN PropertyExistsDelegateTask task; // WHEN task = new PropertyExistsDelegateTask("taskName", "/somePath/someNode", "someProperty", new BootstrapSingleModuleResource("/info/magnolia/test/website.newtestpages1.xml"), new BootstrapSingleModuleResource("/info/magnolia/test/website.newtestpages2.xml") ); // THEN assertEquals( "Execute task [Bootstraps module resource '/info/magnolia/test/website.newtestpages1.xml' from '/mgnl-bootstrap/' folder.] if property '/somePath/someNode/someProperty' exists " + "or [Bootstraps module resource '/info/magnolia/test/website.newtestpages2.xml' from '/mgnl-bootstrap/' folder.] if not.", task.getDescription()); } }
public ExchangeSimpleModuleVersionHandler() { super(); register(DeltaBuilder.checkPrecondition("4.4.6", "4.5")); register(DeltaBuilder.update("4.5", "URL of activation filter is no longer password protected but uses encryption instead.") .addTask(new BootstrapSingleModuleResource("Configure ActivationPage", "Register class to be used.", "config.modules.exchange-simple.pages.activationPage.xml")) .addTask(new BootstrapSingleModuleResource("ActivationPage Menu", "Configure menu in AdminInterface.", "config.modules.adminInterface.config.menu.tools.activationPage.xml")) .addTask(new IsAuthorInstanceDelegateTask("Security update", "Update security keys if on author instance.", new AbstractTask("", "") { @Override public void execute(InstallContext installContext) throws TaskExecutionException { try { SecurityUtil.updateKeys(SecurityUtil.generateKeyPair(1024)); } catch (NoSuchAlgorithmException e) { throw new TaskExecutionException(e.getMessage(), e); } } })) .addTask(new FilterOrderingTask("activation", new String[] { "context", "login", "multipartRequest" }))); register(DeltaBuilder.update("4.5.8", "") .addTask(new BootstrapSingleModuleResource("Configure Activation Log Storage", "Register ActivationLogStorage class", "config.modules.exchange-simple.config.activationLogStorage.xml")) .addTask(new BootstrapSingleModuleResource("Configure ActivationMonitorPage", "Register ActivationMonitorPage class", "config.modules.exchange-simple.pages.activationMonitor.xml")) .addTask(new BootstrapSingleModuleResource("Activation Monitor Page in menu", "Register Activation Monitor page in AdminInterface Tools menu", "config.modules.adminInterface.config.menu.tools.activationMonitor.xml")) .addTask(new OrderNodeAfterTask("Order Activation Monitor menu item.", "Order Activation Monitor menu item.", RepositoryConstants.CONFIG, "/modules/adminInterface/config/menu/tools/activationMonitor", "activationPage"))); }
public RestIntegrationModuleVersionHandler() { register(DeltaBuilder.update("2.0", "") .addTask(new UpdateRestEditorRoleTask("Update old rest role to new rest-editor role", "")) .addTask(new BootstrapSingleModuleResource("Bootstrap file userroles.rest-admin.xml", "", "userroles.rest-admin.xml")) .addTask(new BootstrapSingleModuleResource("Bootstrap file userroles.rest-anonymous.xml", "", "userroles.rest-anonymous.xml")) .addTask(new RemoveRoleFromUserTask("Remove rest-editor role from superuser", "superuser", "rest-editor")) .addTask(new AddRoleToUserTask("Add role 'rest-admin' to user 'superuser'", "superuser", "rest-admin")) .addTask(new AddRoleToUserTask("Add role 'rest-anonymous' to user 'anonymous'", "anonymous", "rest-anonymous")) ); }
public SchedulerModuleVersionHandler() { register(DeltaBuilder.update("2.1.1", "") .addTask(new BootstrapSingleModuleResource("config.modules.scheduler.messageViews.xml")) ); register(DeltaBuilder.update("2.1.3", "") .addTask(new RenamePropertiesTask("Rename deprecated properties", RepositoryConstants.CONFIG, "/modules/scheduler/config/jobs", "active", "enabled")) ); }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new BootstrapSingleModuleResource("resourceName"); // THEN assertEquals("Bootstraps module resource 'resourceName' from '/mgnl-bootstrap/' folder.", task.getDescription()); } }
@Test public void partialXmlBootstrap() throws Exception { // GIVEN Node child = NodeUtil.createPath(session.getRootNode(), "parent/child", NodeTypes.ContentNode.NAME); child.setProperty("propertyWhichShouldBeRemoved", "propertyWhichShouldBeRemoved"); final BootstrapSingleModuleResource task = new BootstrapSingleModuleResource("", "", "config.parent.xml", "parent/child"); // WHEN task.execute(ctx); //THEN assertThat(session.getRootNode(), hasNode("parent")); assertThat(session.getNode("/parent"), hasNode("child")); assertThat(session.getNode("/parent/child"), not(hasProperty("propertyWhichShouldBeRemoved"))); }
@Test public void partialYamlBootstrap() throws Exception { // GIVEN Node child = NodeUtil.createPath(session.getRootNode(), "/parent/child", NodeTypes.ContentNode.NAME); child.setProperty("propertyWhichShouldBeRemoved", "propertyWhichShouldBeRemoved"); final BootstrapSingleModuleResource task = new BootstrapSingleModuleResource("", "", "config.parent.yaml", "/parent/child"); // WHEN task.execute(ctx); //THEN assertThat(session.getRootNode(), hasNode("parent")); assertThat(session.getNode("/parent"), hasNode("child")); assertThat(session.getNode("/parent"), not(hasNode("sibling"))); assertThat(session.getNode("/parent/child"), hasProperty("property", "value")); assertThat(session.getNode("/parent/child"), not(hasProperty("propertyWhichShouldBeRemoved"))); }
public SiteModuleVersionHandler() { register(DeltaBuilder.update("1.0.1", "") .addTask(updateI18nContentSupport)); register(DeltaBuilder.update("1.0.3", "") .addTask(new NodeExistsDelegateTask("Create empty site definition node if it does not exist", "/modules/site/config/site", null, new BootstrapSingleModuleResource("config.modules.site.config.site.xml")))); register(DeltaBuilder.update("1.0.5", "") .addTask(new BootstrapConditionally("Add site-aware JSP renderer if it does not exist", "/mgnl-bootstrap/site/config.modules.site.renderers.site-jsp.xml")) .addTask(new PropertyValueDelegateTask("Reconfigure site renderer to delegate to freemarker renderer", "/modules/site/renderers/site", "class", SiteAwareFreemarkerRenderer.class.getName(), true, new ArrayDelegateTask("", new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/renderers/site", "wrappedRendererType", "freemarker"), new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/renderers/site", "class", SiteAwareRendererWrapper.class.getName()), new RemoveNodeTask("", "/modules/site/renderers/site/contextAttributes"), new RemovePropertyTask("", "/modules/site/renderers/site/", "type")))) .addTask(orderSiteMergeFilter) //fix incorrect order of siteMerge filter after update from M5.3 which is before multiSite filter ); register(DeltaBuilder.update("1.1", "") .addTask(new NodeExistsDelegateTask("Remove themes folder if empty", "Location /modules/site/config/themes is deprecated but still supported", RepositoryConstants.CONFIG, "/modules/site/config/themes", new RemoveNodeWithoutChildren("/modules/site/config/themes")))); }
public MailModuleVersionHandler() { register(DeltaBuilder.update("4.5", "") .addTask(new BootstrapSingleModuleResource("Templates configuration", "Reconfigures the templates configuration.", "config.modules.mail.config.templatesConfiguration.xml"))); new RemovePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/mail/config/factory/renderers/", "velocity"))) .addTask(new RemoveNodeTask("Remove legacy ui page", "Removes old legacy adminInterface page.", RepositoryConstants.CONFIG, "/modules/mail/pages")) .addTask(new BootstrapSingleModuleResource("Bootstrap field types", "Bootstraps new field types used by mail tools app.", "config.modules.mail.fieldTypes.xml")) .addTask(new BootstrapSingleModuleResource("Bootstrap app", "Bootstraps mail app.", "config.modules.mail.apps.xml")) .addTask(new BootstrapSingleModuleResource("Bootstrap simple mail configuration", "Bootstraps simple mail configuration.", "config.modules.mail.config.simpleConfiguration.xml")) .addTask(new BootstrapSingleModuleResource("Bootstrap mail command", "Bootstraps send mail command.", "config.modules.mail.commands.default.sendMail.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING)) .addTask(new BootstrapSingleModuleResource("Bootstrap menu item", "Registers mail tools app to app launcher.", "config.modules.ui-admincentral.config.appLauncherLayout.groups.tools.apps.mail.xml")) .addTask(new ConvertAclToAppPermissionTask("Convert permissions for 'sendMail' app", "Convert ACL permissions for old 'sendMail' page to new 'mail' app permission", "/.magnolia/pages/sendMail", "/modules/mail/apps/mail", true)) new BootstrapSingleModuleResource("config.modules.mail.config.smtpConfiguration.xml"), new PropertyExistsDelegateTask("", "/modules/mail/config/smtp/", MailConstants.SMTP_PORT, new MovePropertyTask("", RepositoryConstants.CONFIG, "/modules/mail/config/smtp/smtpPort", "/modules/mail/config/smtpConfiguration/port", true)
public ActivationModuleVersionHandler() { register(DeltaBuilder.update("5.0.2", "") .addTask(new BootstrapSingleModuleResource("Add new versioned activation command chain", "", "config.modules.activation.commands.versioned.xml"))); register(DeltaBuilder.update("5.1.1", "") .addTask(new IsModuleInstalledOrRegistered("Modify default delete command", "Change default delete command to do deactivation of content from public instance and then remove content from public instance", new RemoveNodeTask("Remove Activation tools from dev group of appLauncher", "", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/dev/apps/activation")) ), new BootstrapSingleModuleResource("Bootstrap app", "Bootstrap activation apps.", "config.modules.activation.apps.xml") )) );
"/mgnl-bootstrap/core/config.server.IPConfig.xml"), new BootstrapSingleModuleResource("i18n content", "bootstrap the config", "config.server.i18n.content.xml"), new BootstrapSingleModuleResource("i18n system", "bootstrap the config", "config.server.i18n.system.xml"),
.addTask(new RemoveNodeTask("Remove PageEditorServlet", "Remove obsolete PageEditorServlet configuration.", RepositoryConstants.CONFIG, "/server/filters/servlets/PageEditorServlet")) .addTask(new RemoveNodeTask("Remove obsolete 'templating-editor' configuration", "", RepositoryConstants.CONFIG, "/modules/magnolia-templating-editor")) .addTask(new BootstrapSingleModuleResource("Bootstrap link transformers", "Bootstrap 'server/rendering/linkManagement/transformers", "config.server.rendering.linkManagement.xml", "/linkManagement/transformers"))); register((DeltaBuilder.update("5.0.1", "")) .addTask(new CheckAndModifyPropertyValueTask("MIMEMapping", "Change xsl extension mime-type from text/xml to application/xml", RepositoryConstants.CONFIG, "/server/MIMEMapping/xsl", "mime-type", "text/xml", "application/xml")) .addTask(new CheckAndModifyPropertyValueTask("MIMEMapping", "Change xml extension mime-type from text/xml to application/xml", RepositoryConstants.CONFIG, "/server/MIMEMapping/xml", "mime-type", "text/xml", "application/xml"))); register((DeltaBuilder.update("5.0.3", "")) .addTask(new BootstrapSingleModuleResource("JSON", "Add JSON mime-type", "config.server.MIMEMapping.xml", "/MIMEMapping/json"))); register((DeltaBuilder.update("5.1", "")) .addTask(new WarnTask("respectOrderDocument parameter", "As of Magnolia 5.1, the respectOrderDocument parameter has been reintroduced in repo config files and set to true by default. You will need to set it manually for each workspace in your installation. Please, refer to the release notes for more details.")) register((DeltaBuilder.update("5.1.2", "")) .addTask(new ChangeNodeTypeOfSubAppsTask("Change primary node type of subapps", "If primary node type of subapps node is set to " + NodeTypes.Content.NAME + " then change it to " + NodeTypes.ContentNode.NAME)) .addTask(new BootstrapSingleModuleResource("Anonymous user", "Change anonymous user permission. He can't have write access to himself.", "users.system.anonymous.xml", "/anonymous/acl_users"))); .addTask(new BootstrapSingleModuleResource("Add mime mapping for .map", "Add mime mapping for .map", "config.server.MIMEMapping.xml", "/MIMEMapping/map"))); .addTasks(getLockableMixinAdditionTasksForAllWorkspaces()) .addTask(new NodeExistsDelegateTask("Add korean language into system languages", "/server/i18n/system/ko", null, new BootstrapSingleModuleResource("", "", "config.server.i18n.system.xml", "/system/languages/ko"))) ); .addTask(new BootstrapSingleModuleResource("Add mime mapping for YAML", "Add mime mapping for YAML", "config.server.MIMEMapping.xml", "/MIMEMapping/x-yaml")) .addTask(new RenameVersionNodesTask(repositoryManager)) ); new RemovePropertyTask("", "/server/filters/csrfTokenSecurity", "enabled")), new ArrayDelegateTask("Add csrfTokenSecurity filter", "", new BootstrapSingleModuleResource("", "", "config.server.filters.xml", "/filters/csrfTokenSecurity"),
.addTask(new BootstrapSingleModuleResource("Rendering Engine", "Add configuration for the new rendering engine.", "config.server.rendering.engine.xml")) );
.addTask(new BootstrapSingleModuleResource("Register the new DataSelectField", "", "config.modules.ui-framework.fieldTypes.dataSelectField.xml")) .addTask(new AddFolderSupportToDataAppsTask("Add folder support for apps", "Adds folder support for hierarchical data types", new String[] { "Contact", "RssAggregator", "category" })));
.addTask(new BootstrapSingleModuleResource("Bootstrap 'contact-base' role.", "", "userroles.contact-base.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)) .addTask(new AddRoleToUserTask("Add the contact-base role to the anonymous user", "anonymous", "contact-base")) );
); register(DeltaBuilder.update("5.6.1", "") .addTask(new BootstrapSingleModuleResource("config.modules.cache.config.contentCaching.defaultPageCache.flushPolicy.policies.lightModule.xml")) .addTask(new NodeExistsDelegateTask("If compression config exists, update JS mime types", "/modules/cache/config/compression/voters/contentType/allowed", new ArrayDelegateTask("Update compression config",
.addTask(new BootstrapSingleModuleResource("Bootstrap button", "Bootstrap button for immediate import", "config.modules.rssaggregator.fieldTypes.xml")) .addTask(setDefaultValues) .addTask(new PartialBootstrapTask("Bootstrap schedule tab", "Updates app with tab enabling RSS scheduling", "/mgnl-bootstrap/rssaggregator/app/config.modules.rssaggregator.apps.xml", "/apps/rssAggregator/subApps/detail/editor/form/tabs/scheduleTab", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))