From: <fg...@us...> - 2008-06-08 11:38:23
|
Revision: 825 http://openutils.svn.sourceforge.net/openutils/?rev=825&view=rev Author: fgiust Date: 2008-06-08 04:38:26 -0700 (Sun, 08 Jun 2008) Log Message: ----------- ready for 3.5.2 Modified Paths: -------------- trunk/openutils-mgnltasks/pom.xml trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/CheckAndCreateUserTask.java trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DeleteNodeTask.java trunk/openutils-mgnltasks/src/site/changes/changes.xml trunk/openutils-mgnltasks/src/site/site.xml Added Paths: ----------- trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DisableSubscribersTask.java trunk/openutils-mgnltasks/src/site/apt/howto.apt Modified: trunk/openutils-mgnltasks/pom.xml =================================================================== --- trunk/openutils-mgnltasks/pom.xml 2008-05-07 12:57:08 UTC (rev 824) +++ trunk/openutils-mgnltasks/pom.xml 2008-06-08 11:38:26 UTC (rev 825) @@ -40,12 +40,12 @@ <dependency> <groupId>info.magnolia</groupId> <artifactId>magnolia-core</artifactId> - <version>3.5.4</version> + <version>3.5.8</version> </dependency> <dependency> <groupId>info.magnolia</groupId> <artifactId>magnolia-module-admininterface</artifactId> - <version>3.5.4</version> + <version>3.5.8</version> </dependency> <dependency> <groupId>javax.servlet</groupId> Modified: trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java =================================================================== --- trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java 2008-05-07 12:57:08 UTC (rev 824) +++ trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/AnonymousUserSetupTask.java 2008-06-08 11:38:26 UTC (rev 825) @@ -44,8 +44,7 @@ private boolean allowAccess; /** - * @param name - * @param description + * @param allowAccess true to add access to anonymous users, false to remove it */ public AnonymousUserSetupTask(boolean allowAccess) { Modified: trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/CheckAndCreateUserTask.java =================================================================== --- trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/CheckAndCreateUserTask.java 2008-05-07 12:57:08 UTC (rev 824) +++ trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/CheckAndCreateUserTask.java 2008-06-08 11:38:26 UTC (rev 825) @@ -43,8 +43,7 @@ /** * @param user User path (e.g. /system/superuser) - * @param defaultPassword default password - * @param newpassword new password, will be set only if the current password matches the default one + * @param bootstrapFile bootstrap file used to create the user */ public CheckAndCreateUserTask(String user, String bootstrapFile) { Modified: trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DeleteNodeTask.java =================================================================== --- trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DeleteNodeTask.java 2008-05-07 12:57:08 UTC (rev 824) +++ trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DeleteNodeTask.java 2008-06-08 11:38:26 UTC (rev 825) @@ -38,10 +38,8 @@ private final String nodePath; /** - * @param workspaceName - * @param nodePath - * @param propertyName - * @param newValue + * @param workspaceName workspace (for example "config") + * @param nodePath node path */ public DeleteNodeTask(String workspaceName, String nodePath) { Added: trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DisableSubscribersTask.java =================================================================== --- trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DisableSubscribersTask.java (rev 0) +++ trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DisableSubscribersTask.java 2008-06-08 11:38:26 UTC (rev 825) @@ -0,0 +1,76 @@ +/** + * Copyright Openmind http://www.openmindonline.it + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package it.openutils.mgnltasks; + +import info.magnolia.cms.core.Content; +import info.magnolia.cms.core.HierarchyManager; +import info.magnolia.cms.core.NodeData; +import info.magnolia.cms.util.ContentUtil; +import info.magnolia.module.InstallContext; +import info.magnolia.module.delta.AbstractRepositoryTask; +import info.magnolia.module.delta.TaskExecutionException; + +import java.util.List; + +import javax.jcr.RepositoryException; + + +/** + * Disable any configured subscriber. + * @author fgiust + * @version $Id: $ + */ +public class DisableSubscribersTask extends AbstractRepositoryTask +{ + + private String subscribersPath = "/server/activation/subscribers"; + + public DisableSubscribersTask() + { + super("Disabling subscribers", "Disabling subscribers"); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException + { + + HierarchyManager hm = installContext.getHierarchyManager("config"); + + if (hm.isExist(subscribersPath)) + { + + Content subscribersNode = hm.getContent(subscribersPath); + List<Content> subscribers = ContentUtil.collectAllChildren(subscribersNode); + + for (Content content : subscribers) + { + NodeData nd = content.getNodeData("active"); + if (nd.getBoolean()) + { + nd.setValue(false); + } + + } + } + } + +} Property changes on: trunk/openutils-mgnltasks/src/main/java/it/openutils/mgnltasks/DisableSubscribersTask.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/openutils-mgnltasks/src/site/apt/howto.apt =================================================================== --- trunk/openutils-mgnltasks/src/site/apt/howto.apt (rev 0) +++ trunk/openutils-mgnltasks/src/site/apt/howto.apt 2008-06-08 11:38:26 UTC (rev 825) @@ -0,0 +1,85 @@ + -------------------------- + O p e n u t i l s + -------------------------- + Fabrizio Giustina + -------------------------- + +Usage + + You can subclass openutils' SimpleModuleVersionHandler in order to get a fully functional module version handler ready. + + SimpleModuleVersionHandler will by default take care of (read carefully!): + + * Re-bootstrapping all its configuration (config workspace) when the version number changes + + * Update the module version in the jcr repository + + [] + + + In addition to this, you can override the getStartupTasks() method and, by using the standard tasks provided by + magnolia itself or openutils-mgnltasks, perform all the sorts of initialization/configuration/checks you may need. + + See the example below for an inspiration on how you could setup your content modules: + + ++------------------------------------------------+ + +public class MymoduleModuleVersionHandler extends SimpleModuleVersionHandler +{ + + public List<Task> getStartupTasks(InstallContext installContext) + { + + boolean admin = SystemProperty.getBooleanProperty("magnolia.bootstrap.authorInstance"); + boolean develop = SystemProperty.getBooleanProperty("magnolia.develop"); + + List<Task> tasks = new ArrayList<Task>(); + + // allow access for public or development instances only + tasks.add(new AnonymousUserSetupTask(!admin || develop)); + + // configure the smtp from magnolia.properties + String smtp = SystemProperty.getProperty("mail.host"); + if (StringUtils.isNotEmpty(smtp)) + { + tasks.add(new SetPropertyTask("config", "/modules/mail/config/smtp", "smtpServer", smtp)); + } + + // sort dialogs and paragraphs by name, templates by title + tasks.add(new NodeSortTask("config", "/modules/mymodule/dialogs")); + tasks.add(new NodeSortTask("config", "/modules/mymodule/paragraphs")); + tasks.add(new NodeSortTask("config", "/modules/mymodule/templates", "title")); + + // don't use COS + tasks.add(new SetPropertyTask( + "config", + "/server/filters/multipartRequest", + "class", + "info.magnolia.cms.filters.MultipartRequestFilter")); + + // we want to be able to set a different default page in magnolia.properties + String defaultpage = !admin || develop + ? "redirect:" + SystemProperty.getProperty("magnolia.defaultpage") + : "redirect:/.magnolia/pages/adminCentral.html"; + tasks.add(new SetPropertyTask( + "config", + "/modules/adminInterface/virtualURIMapping/default", + "toURI", + defaultpage)); + + // adds a new admin user if missing + tasks.add(new CheckAndCreateUserTask("/admin/admin", "/mgnl-bootstrap/users/users.admin.admin.xml")); + + // disable any subscriber during development + if (develop || !admin) + { + tasks.add(new DisableSubscribersTask()); + } + + return tasks; + } + +} + ++------------------------------------------------+ Property changes on: trunk/openutils-mgnltasks/src/site/apt/howto.apt ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/openutils-mgnltasks/src/site/changes/changes.xml =================================================================== --- trunk/openutils-mgnltasks/src/site/changes/changes.xml 2008-05-07 12:57:08 UTC (rev 824) +++ trunk/openutils-mgnltasks/src/site/changes/changes.xml 2008-06-08 11:38:26 UTC (rev 825) @@ -8,9 +8,10 @@ <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> </properties> <body> - <release version="3.5.2" date="in svn" description="in svn"> + <release version="3.5.2" date="2008-06-08" description="in svn"> <action type="add" dev="fgiust">Added [modulename].update.disabled property in SimpleModuleVersionHandler that can be set to true in order to disable module configuration updates</action> + <action type="add" dev="fgiust">Added it.openutils.mgnltasks.DisableSubscribersTask</action> </release> <release version="3.5.1" date="2008-04-28" description="3.5.1"> <action type="add" dev="fgiust">Added UpdateModuleVersionTask.</action> Modified: trunk/openutils-mgnltasks/src/site/site.xml =================================================================== --- trunk/openutils-mgnltasks/src/site/site.xml 2008-05-07 12:57:08 UTC (rev 824) +++ trunk/openutils-mgnltasks/src/site/site.xml 2008-06-08 11:38:26 UTC (rev 825) @@ -22,6 +22,7 @@ </breadcrumbs> <menu name="openutils mgnltasks"> <item name="Introduction" href="index.html"></item> + <item name="How to" href="howto.html"></item> </menu> <menu ref="modules" inherit="bottom" /> <menu ref="reports" inherit="bottom" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |