diff --git a/ccm-cms/application.xml b/ccm-cms/application.xml index 14f7ee5f9..a42d7b8ea 100755 --- a/ccm-cms/application.xml +++ b/ccm-cms/application.xml @@ -3,7 +3,7 @@ name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.6.0" - release="1" + release="2" webapp="ROOT"> @@ -14,6 +14,6 @@ The CMS applications provides a flexible Content Management -System for the CCM platform. + System for the CCM platform. diff --git a/ccm-cms/src/ccm-cms.config b/ccm-cms/src/ccm-cms.config index 33c205a29..c51a47288 100755 --- a/ccm-cms/src/ccm-cms.config +++ b/ccm-cms/src/ccm-cms.config @@ -4,4 +4,6 @@ storage="ccm-cms/cms.properties"/> + diff --git a/ccm-cms/src/com/arsdigita/cms/ACSObjectFactory.java b/ccm-cms/src/com/arsdigita/cms/ACSObjectFactory.java index 02f182832..2e1bde8c8 100755 --- a/ccm-cms/src/com/arsdigita/cms/ACSObjectFactory.java +++ b/ccm-cms/src/com/arsdigita/cms/ACSObjectFactory.java @@ -40,14 +40,12 @@ import java.util.Iterator; * Provides static methods to instantiate proper subclasses of {@link * com.arsdigita.kernel.ACSObject} domain objects, based on the object * type and the Java class name. + * @see com.arsdigita.kernel.ACSObject * * @version $Id: ACSObjectFactory.java 287 2005-02-22 00:29:02Z sskracic $ - * @see com.arsdigita.kernel.ACSObject */ public class ACSObjectFactory extends DomainService { - public static final String versionId = "$Id: ACSObjectFactory.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - private static Logger s_log = Logger.getLogger(ACSObjectFactory.class); diff --git a/ccm-cms/src/com/arsdigita/cms/Article.java b/ccm-cms/src/com/arsdigita/cms/Article.java index 767d60924..f16940c2b 100755 --- a/ccm-cms/src/com/arsdigita/cms/Article.java +++ b/ccm-cms/src/com/arsdigita/cms/Article.java @@ -34,7 +34,7 @@ import java.math.BigDecimal; * @author Jack Chung (flattop@arsdigita.com) * @version $Revision: #28 $ $Date: 2004/08/17 $ * @version $Id: Article.java 287 2005-02-22 00:29:02Z sskracic $ - **/ + */ public class Article extends TextPage { public static final String BASE_DATA_OBJECT_TYPE = diff --git a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java b/ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java index c88ea6dd4..fd1abf566 100755 --- a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java @@ -23,24 +23,22 @@ import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.Filter; /** - * This class contains contains a collection of - * ArticleImageAssociations, each of which points to an image, and - * each of which has a caption. Ideally it should be constructed with - * a DataCollection of ArticleImageAssociations which has been - * filtered on isDeleted=0, or there will be deleted associations in - * the collection. It extends ImageAssetCollection because we need to - * pass it off as an ImageAssetCollection at various places in the UI - * code. - * - * @author Hugh Brock . + * This class contains contains a collection of ArticleImageAssociations, each + * of which points to an image, and each of which has a caption. Ideally it + * should be constructed with a DataCollection of ArticleImageAssociations + * which has been filtered on isDeleted=0, or there will be deleted associations + * in the collection. It extends ImageAssetCollection because we need to pass + * it off as an ImageAssetCollection at various places in the UI code. * * @see com.arsdigita.domain.DomainCollection * @see com.arsdigita.persistence.DataCollection + * + * + * @author Hugh Brock . + * @version $Id: ArticleImageAssnCollection.java 287 2005-02-22 00:29:02Z sskracic $ */ public class ArticleImageAssnCollection extends ImageAssetCollection { - public static final String versionId = "$Id: ArticleImageAssnCollection.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - /** * Constructor. Should only be called from Article.getImages() * diff --git a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java b/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java index 002b2c311..037b50eea 100755 --- a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java +++ b/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java @@ -36,10 +36,10 @@ import java.math.BigDecimal; * * @author Jack Chung (flattop@arsdigita.com) * @version $Revision: #17 $ $Date: 2004/08/17 $ + * @version $Id: ArticleImageAssociation.java 287 2005-02-22 00:29:02Z sskracic $ */ public class ArticleImageAssociation extends ContentItem { - public static final String versionId = "$Id: ArticleImageAssociation.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.ArticleImageAssociation"; @@ -58,9 +58,9 @@ public class ArticleImageAssociation extends ContentItem { } /** - * Constructor. The contained DataObject is retrieved - * from the persistent storage mechanism with an OID - * specified by oid. + * Constructor retrieved the contained DataObject from the + * persistent storage mechanism with an OID specified by + * oid. * * @param oid The OID for the retrieved * DataObject. diff --git a/ccm-cms/src/com/arsdigita/cms/Asset.java b/ccm-cms/src/com/arsdigita/cms/Asset.java index 26d5c7e15..adada7a9c 100755 --- a/ccm-cms/src/com/arsdigita/cms/Asset.java +++ b/ccm-cms/src/com/arsdigita/cms/Asset.java @@ -34,11 +34,10 @@ import java.io.IOException; * @author Jack Chung * * @version $Revision: #21 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: Asset.java 287 2005-02-22 00:29:02Z sskracic $ */ public abstract class Asset extends ContentItem { - public static final String versionId = "$Id: Asset.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.Asset"; diff --git a/ccm-cms/src/com/arsdigita/cms/AuthoringKit.java b/ccm-cms/src/com/arsdigita/cms/AuthoringKit.java index 52d3549d6..7ed2d476f 100755 --- a/ccm-cms/src/com/arsdigita/cms/AuthoringKit.java +++ b/ccm-cms/src/com/arsdigita/cms/AuthoringKit.java @@ -36,11 +36,10 @@ import java.math.BigDecimal; * @author Jack Chung (flattop@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com) * @version $Revision: #17 $ $Date: 2004/08/17 $ + * @version $Id: AuthoringKit.java 287 2005-02-22 00:29:02Z sskracic $ */ public class AuthoringKit extends ACSObject { - public static final String versionId = "$Id: AuthoringKit.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.AuthoringKit"; diff --git a/ccm-cms/src/com/arsdigita/cms/CMS.java b/ccm-cms/src/com/arsdigita/cms/CMS.java index 9aea5e409..c17a9a99d 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMS.java +++ b/ccm-cms/src/com/arsdigita/cms/CMS.java @@ -29,12 +29,9 @@ import org.apache.log4j.Logger; * * @author Daniel Berrange * @see com.arsdigita.kernel.Kernel + * @version $Id: CMS.java 287 2005-02-22 00:29:02Z sskracic $ */ public abstract class CMS { - public static final String versionId = - "$Id: CMS.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/17 23:15:09 $"; /** * The CMS XML namespace. diff --git a/ccm-cms/src/com/arsdigita/cms/CMSContext.java b/ccm-cms/src/com/arsdigita/cms/CMSContext.java index 9cd899bd0..e4bfebe9d 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSContext.java +++ b/ccm-cms/src/com/arsdigita/cms/CMSContext.java @@ -35,16 +35,14 @@ import org.apache.log4j.Logger; * not null. If the caller wants to handle the case where an item is * null explicitly, then use the hasContentItem and hasContentSection * methods first. - * - * @author Daniel Berrange + * * @see com.arsdigita.kernel.KernelContext * @see com.arsdigita.cms.CMS + * + * @author Daniel Berrange + * @version $Id: CMSContext.java 778 2005-09-12 14:55:36Z fabrice $ */ public final class CMSContext { - public static final String versionId = - "$Id: CMSContext.java 778 2005-09-12 14:55:36Z fabrice $" + - "$Author: fabrice $" + - "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger(CMSContext.class); diff --git a/ccm-cms/src/com/arsdigita/cms/CMSExcursion.java b/ccm-cms/src/com/arsdigita/cms/CMSExcursion.java index 9b5270499..0a0b13986 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSExcursion.java +++ b/ccm-cms/src/com/arsdigita/cms/CMSExcursion.java @@ -25,7 +25,6 @@ import javax.servlet.ServletException; import org.apache.log4j.Logger; /** - * * A CMS excursion is a way of making your code execute under an * alternative environment (context). Override the excurse method to * create a CMSExcursion. For example: @@ -42,16 +41,13 @@ import org.apache.log4j.Logger; * * excursion.run(); * - * - * @author Daniel Berrange * @see com.arsdigita.cms.CMS * @see com.arsdigita.kernel.KernelExcursion + * + * @author Daniel Berrange + * @version $Id: CMSExcursion.java 287 2005-02-22 00:29:02Z sskracic $ */ public abstract class CMSExcursion { - public static final String versionId = - "$Id: CMSExcursion.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger(CMSExcursion.class); diff --git a/ccm-cms/src/com/arsdigita/cms/CategoryTemplateCollection.java b/ccm-cms/src/com/arsdigita/cms/CategoryTemplateCollection.java index 687052e94..85e0c8fbc 100755 --- a/ccm-cms/src/com/arsdigita/cms/CategoryTemplateCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/CategoryTemplateCollection.java @@ -24,16 +24,14 @@ import com.arsdigita.persistence.DataCollection; /** * This class contains a collection of {@link CategoryTemplateMapping}s * - * @version $Id: CategoryTemplateCollection.java 754 2005-09-02 13:26:17Z sskracic $ - * * @see DomainCollection * @see DataCollection * @see ItemTemplateCollection + * + * @version $Id: CategoryTemplateCollection.java 754 2005-09-02 13:26:17Z sskracic $ */ public class CategoryTemplateCollection extends TemplateCollection { - public static final String versionId = "$Id: CategoryTemplateCollection.java 754 2005-09-02 13:26:17Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - /** * Constructor. * diff --git a/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java b/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java index e76c29a25..0cdfbb036 100755 --- a/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java +++ b/ccm-cms/src/com/arsdigita/cms/CategoryTemplateMapping.java @@ -37,8 +37,6 @@ import java.math.BigDecimal; */ public class CategoryTemplateMapping extends TemplateMapping { - public static final String versionId = "$Id: CategoryTemplateMapping.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.CategoryTemplateMapping"; diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItem.java b/ccm-cms/src/com/arsdigita/cms/ContentItem.java index fc641c155..dab54d4aa 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentItem.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentItem.java @@ -201,10 +201,6 @@ import java.util.Set; * @version $Id: ContentItem.java 1621 2007-09-13 12:43:12Z chrisg23 $ */ public class ContentItem extends VersionedACSObject implements CustomCopy { - public static final String versionId = - "$Id: ContentItem.java 1621 2007-09-13 12:43:12Z chrisg23 $" + - "$Author: chrisg23 $" + - "$DateTime: $"; private static final Logger s_log = Logger.getLogger(ContentItem.class); private static final Logger s_logDenorm = Logger.getLogger(ContentItem.class.getName() + ".Denorm"); diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItemInstantiator.java b/ccm-cms/src/com/arsdigita/cms/ContentItemInstantiator.java index 5666d8bcd..4a28256d6 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentItemInstantiator.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentItemInstantiator.java @@ -28,15 +28,13 @@ import com.arsdigita.persistence.DataObject; * class should always instantiate the right subclass of {@link * com.arsdigita.cms.ContentItem} automatically. * - * @deprecated Use {@link com.arsdigita.kernel.ACSObjectInstantiator} - * instead * @author Stanislav Freidin * @version $Id: ContentItemInstantiator.java 287 2005-02-22 00:29:02Z sskracic $ + * @deprecated Use {@link com.arsdigita.kernel.ACSObjectInstantiator} + * instead */ public class ContentItemInstantiator extends DomainObjectInstantiator { - public static final String versionId = "$Id: ContentItemInstantiator.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - /** * Construct a {@link ContentItem} given a data object. Called from * DomainObjectFactory.newInstance() as the last step of diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSection.java b/ccm-cms/src/com/arsdigita/cms/ContentSection.java index feaafadb1..91dec0641 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSection.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSection.java @@ -27,7 +27,7 @@ import com.arsdigita.cms.dispatcher.ResourceMapping; import com.arsdigita.cms.dispatcher.ResourceType; import com.arsdigita.cms.dispatcher.TemplateResolver; import com.arsdigita.cms.dispatcher.XMLGenerator; -import com.arsdigita.cms.ContentSectionConfig; +// import com.arsdigita.cms.ContentSectionConfig; import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection; import com.arsdigita.cms.util.GlobalizationUtil; @@ -89,12 +89,9 @@ import java.math.BigDecimal; * @author Michael Pih * @author Jack Chung * @version $Revision: #37 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: ContentSection.java 1308 2006-09-01 11:00:05Z sskracic $ */ public class ContentSection extends Application { - public static final String versionId = - "$Id: ContentSection.java 1308 2006-09-01 11:00:05Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger(ContentSection.class); diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionCollection.java b/ccm-cms/src/com/arsdigita/cms/ContentSectionCollection.java index 5161de536..f54701b99 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSectionCollection.java @@ -26,16 +26,14 @@ import com.arsdigita.persistence.DataCollection; * This class contains a collection of {@link * com.arsdigita.cms.ContentSection content sections}. * - * @author Stanislav Freidin (sfreidin@arsdigita.com) - * @version $Id: ContentSectionCollection.java 287 2005-02-22 00:29:02Z sskracic $ - * * @see com.arsdigita.domain.DomainCollection * @see com.arsdigita.persistence.DataCollection - **/ + * + * @author Stanislav Freidin (sfreidin@arsdigita.com) + * @version $Id: ContentSectionCollection.java 287 2005-02-22 00:29:02Z sskracic $ + */ public class ContentSectionCollection extends DomainCollection { - public static final String versionId = "$Id: ContentSectionCollection.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - /** * Constructor. * diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java b/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java index 6aa931733..b972f8927 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig.java @@ -37,8 +37,9 @@ import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.MultilingualItemResolver; import com.arsdigita.cms.dispatcher.TemplateResolver; import com.arsdigita.cms.lifecycle.PublishLifecycleListener; -import com.arsdigita.cms.publishToFile.PublishToFile; -import com.arsdigita.cms.publishToFile.PublishToFileListener; +// import com.arsdigita.cms.publishToFile.PublishToFile; +import com.arsdigita.cms.publishToFile.PublishToFileConfig; +// import com.arsdigita.cms.publishToFile.PublishToFileListener; import com.arsdigita.cms.ui.authoring.ItemCategoryExtension; import com.arsdigita.cms.ui.authoring.ItemCategoryForm; import com.arsdigita.runtime.AbstractConfig; @@ -47,16 +48,17 @@ import com.arsdigita.runtime.AbstractConfig; // import com.arsdigita.util.UncheckedWrapperException; // URL resource: protocol handler removal: END import com.arsdigita.util.parameter.BooleanParameter; -import com.arsdigita.util.parameter.ClassParameter; +// import com.arsdigita.util.parameter.ClassParameter; import com.arsdigita.util.parameter.EnumerationParameter; import com.arsdigita.util.parameter.ErrorList; import com.arsdigita.util.parameter.IntegerParameter; import com.arsdigita.util.parameter.Parameter; -import com.arsdigita.util.parameter.ParameterError; +// import com.arsdigita.util.parameter.ParameterError; // URL resource: protocol handler removal: START // new: import: import com.arsdigita.util.parameter.ResourceParameter; // URL resource: protocol handler removal: END +import com.arsdigita.util.parameter.SpecificClassParameter; import com.arsdigita.util.parameter.StringArrayParameter; import com.arsdigita.util.parameter.StringParameter; // URL resource: protocol handler removal: START @@ -86,8 +88,8 @@ import org.apache.log4j.Logger; /** * A record containing server-session scoped configuration properties. * - * Accessors of this class may return null. Developers should take - * care to trap null return values in their code. + * Accessors of this class may return null. Developers should take care + * to trap null return values in their code. * * @see ContentSection#getConfig() * @@ -108,7 +110,6 @@ public final class ContentSectionConfig extends AbstractConfig { private final Parameter m_languages; private final Parameter m_defaultItemResolverClass; private final Parameter m_defaultTemplateResolverClass; - private final Parameter m_disableItemPfs; private final Parameter m_useSectionCategories; private final Parameter m_itemAdapters; private final Parameter m_useStreamlinedCreation; @@ -119,13 +120,12 @@ public final class ContentSectionConfig extends AbstractConfig { private final Parameter m_hideAdminTabs; private final Parameter m_hideTimezone; private final Parameter m_hideLaunchDate; - private final Parameter m_requireLaunchDate; private final Parameter m_hideUDCTUI; private final Parameter m_hideFolderIndexCheckbox; private final Parameter m_defaultNotificationTime; - private final Parameter m_publishLifecycleListenerClass; - private final Parameter m_publishToFileClass; private final Parameter m_notifyAuthorOnLifecycle; + private final Parameter m_publishLifecycleListenerClass; + private final Parameter m_requireLaunchDate; private final Parameter m_saveTextCleansWordTags; private final Parameter m_hideAdditionalResourceFields; private final Parameter m_disableFileAssetExtraction; @@ -149,6 +149,14 @@ public final class ContentSectionConfig extends AbstractConfig { private final Parameter m_categoryTreeOrdering; private final Parameter m_hideTextAssetUploadFile; private final Parameter m_allowContentCreateInSectionListing; + + // /////////////////////////////////////////// + // publishToFile package related parameter + // /////////////////////////////////////////// + + // Moved to publishToFile.PublishToFileConfig as of version 6.0.2 + // private final Parameter m_disableItemPfs; + // private final Parameter m_publishToFileClass; /** * Do not instantiate this class directly. @@ -246,10 +254,10 @@ public final class ContentSectionConfig extends AbstractConfig { Parameter.OPTIONAL, null); - m_dhtmlEditorHiddenButtons = new StringArrayParameter - ("com.arsdigita.cms.dhtml_editor_hidden_buttons", - Parameter.OPTIONAL, - null); + m_dhtmlEditorHiddenButtons = new StringArrayParameter + ("com.arsdigita.cms.dhtml_editor_hidden_buttons", + Parameter.OPTIONAL, + null); m_hideTemplatesTab = new BooleanParameter ("com.arsdigita.cms.hide_templates_tab", @@ -326,11 +334,11 @@ public final class ContentSectionConfig extends AbstractConfig { ItemCategoryExtension.class, ItemCategoryExtension.class); - m_hideResetLifecycleLink = new BooleanParameter + m_hideResetLifecycleLink = new BooleanParameter ("com.arsdigita.cms.hide_reset_lifecycle_link", Parameter.OPTIONAL, new Boolean(true)); - m_keywordWeight = new IntegerParameter + m_keywordWeight = new IntegerParameter ("com.arsdigita.cms.search.intermedia.keyword_weight", Parameter.OPTIONAL, new Integer(1)); @@ -339,6 +347,7 @@ public final class ContentSectionConfig extends AbstractConfig { ("com.arsdigita.cms.search.intermedia.title_weight", Parameter.OPTIONAL, new Integer(1)); + m_scoreTitleAndKeywords = new BooleanParameter ("com.arsdigita.cms.search.score_title_and_keywords", Parameter.OPTIONAL, @@ -346,10 +355,10 @@ public final class ContentSectionConfig extends AbstractConfig { /** * each entry in the list is a : separated pair. The first string - * is the className for the type (refer to classname column in contenttypes table - * eg com.arsdigita.cms.contenttypes.MultiPartArticle - * Second string is the name of the bebop step component - * eg com.arsdigita.cms.contenttypes.ui.ImageStep + * is the className for the type (refer to classname column in contenttypes table + * eg com.arsdigita.cms.contenttypes.MultiPartArticle + * Second string is the name of the bebop step component + * eg com.arsdigita.cms.contenttypes.ui.ImageStep */ m_skipAssetSteps = new StringArrayParameter ("com.arsdigita.cms.skip_asset_steps", @@ -357,67 +366,68 @@ public final class ContentSectionConfig extends AbstractConfig { null); m_mandatoryDescriptions = new BooleanParameter - ("com.arsdigita.cms.mandatory_descriptions", - Parameter.OPTIONAL, new Boolean(false)); + ("com.arsdigita.cms.mandatory_descriptions", + Parameter.OPTIONAL, new Boolean(false)); - m_deleteExpiryNotificationsWhenSent = new BooleanParameter - ("com.arsdigita.cms.delete_expiry_notification_when_sent", - Parameter.OPTIONAL, new Boolean(false)); + m_deleteExpiryNotificationsWhenSent = new BooleanParameter + ("com.arsdigita.cms.delete_expiry_notification_when_sent", + Parameter.OPTIONAL, new Boolean(false)); m_deleteWorkflowNotificationsWhenSent = new BooleanParameter - ("com.arsdigita.cms.delete_workflow_notification_when_sent", - Parameter.OPTIONAL, new Boolean(false)); + ("com.arsdigita.cms.delete_workflow_notification_when_sent", + Parameter.OPTIONAL, new Boolean(false)); m_categoryTreeOrdering = new EnumerationParameter - ("com.arsdigita.cms.category_tree_order", - Parameter.OPTIONAL, Category.SORT_KEY ); + ("com.arsdigita.cms.category_tree_order", + Parameter.OPTIONAL, Category.SORT_KEY ); - // 2 valid values at the moment - enumeration used rather than boolean in case other - // possible orders are deemed valid + // 2 valid values at the moment - enumeration used rather than boolean + // in case other possible orders are deemed valid ((EnumerationParameter)m_categoryTreeOrdering).put("SortKey", Category.SORT_KEY ); ((EnumerationParameter)m_categoryTreeOrdering).put("Alphabetical", Category.NAME); m_hasContactsAuthoringStep = new BooleanParameter - ("com.arsdigita.cms.has_contacts_authoring_step", - Parameter.REQUIRED, new Boolean(false)); + ("com.arsdigita.cms.has_contacts_authoring_step", + Parameter.REQUIRED, new Boolean(false)); - m_hideTextAssetUploadFile = new BooleanParameter( - "com.arsdigita.cms.hide_text_asset_upload_file", - Parameter.REQUIRED, - new Boolean(false)); + m_hideTextAssetUploadFile = new BooleanParameter + ("com.arsdigita.cms.hide_text_asset_upload_file", + Parameter.REQUIRED, + new Boolean(false)); - m_allowContentCreateInSectionListing = new BooleanParameter( - "com.arsdigita.cms.allow_content_create_in_section_listing", - Parameter.REQUIRED, - new Boolean(true)); + m_allowContentCreateInSectionListing = new BooleanParameter + ("com.arsdigita.cms.allow_content_create_in_section_listing", + Parameter.REQUIRED, + new Boolean(true)); // Lifecycle package m_deleteLifecycleWhenComplete = new BooleanParameter - ("com.arsdigita.cms.delete_lifecycle_when_complete", - Parameter.OPTIONAL, new Boolean(false)); + ("com.arsdigita.cms.delete_lifecycle_when_complete", + Parameter.OPTIONAL, new Boolean(false)); - // PublishToFile package - m_publishToFileClass = new SpecificClassParameter - ("com.arsdigita.cms.publish_to_file_class", - Parameter.REQUIRED, - PublishToFile.class, - PublishToFileListener.class); + // /////////////////////////////////////////// + // publishToFile package related parameter + // /////////////////////////////////////////// // XXX: temporary parameter. will be removed when MapParameter // works and the p2fs initializer is converted away from the // legacy init - m_disableItemPfs = new BooleanParameter - ("com.arsdigita.cms.disable_item_pfs", - Parameter.REQUIRED, new Boolean(false)); - + // Moved to publishToFile.PublishToFileConfig as of version 6.0.2 + // m_disableItemPfs = new BooleanParameter + // ("com.arsdigita.cms.disable_item_pfs", + // Parameter.REQUIRED, new Boolean(false)); + // + // m_publishToFileClass = new SpecificClassParameter + // ("com.arsdigita.cms.publish_to_file_class", + // Parameter.REQUIRED, + // PublishToFile.class, + // PublishToFileListener.class); register(m_templateRootPath); register(m_defaultItemTemplatePath); register(m_defaultFolderTemplatePath); register(m_languages); - register(m_publishToFileClass); - register(m_disableItemPfs); register(m_defaultItemResolverClass); register(m_defaultTemplateResolverClass); register(m_categoryAuthoringAddForm); @@ -448,8 +458,8 @@ public final class ContentSectionConfig extends AbstractConfig { register(m_unpublishedNotFound); register(m_linksOnlyInSameSubsite); register(m_categoryAuthoringExtension); - register(m_hideResetLifecycleLink); - register(m_keywordWeight); + register(m_hideResetLifecycleLink); + register(m_keywordWeight); register(m_titleWeight); register(m_scoreTitleAndKeywords); register(m_skipAssetSteps); @@ -458,9 +468,14 @@ public final class ContentSectionConfig extends AbstractConfig { register(m_deleteExpiryNotificationsWhenSent); register(m_deleteWorkflowNotificationsWhenSent); register(m_categoryTreeOrdering); - register(m_hasContactsAuthoringStep); - register(m_hideTextAssetUploadFile); - register(m_allowContentCreateInSectionListing); + register(m_hasContactsAuthoringStep); + register(m_hideTextAssetUploadFile); + register(m_allowContentCreateInSectionListing); + + // Moved to publishToFile.PublishToFileConfig as of version 6.0.2 + // register(m_disableItemPfs); + // register(m_publishToFileClass); + loadInfo(); } @@ -480,14 +495,6 @@ public final class ContentSectionConfig extends AbstractConfig { return (String) get(m_languages); } - public final Class getPublishToFileClass() { - return (Class) get(m_publishToFileClass); - } - - public final boolean getDisableItemPfs() { - return ((Boolean) get(m_disableItemPfs)).booleanValue(); - } - public final Class getDefaultItemResolverClass() { return (Class) get(m_defaultItemResolverClass); } @@ -532,9 +539,9 @@ public final class ContentSectionConfig extends AbstractConfig { return (String[])get(m_dhtmlEditorPlugins); } - public final String[] getDHTMLEditorHiddenButtons() { - return (String[])get(m_dhtmlEditorHiddenButtons); - } + public final String[] getDHTMLEditorHiddenButtons() { + return (String[])get(m_dhtmlEditorHiddenButtons); + } public final boolean getHideTemplatesTab() { return ((Boolean) get(m_hideTemplatesTab)).booleanValue(); @@ -616,34 +623,27 @@ public final class ContentSectionConfig extends AbstractConfig { return (Class) get(m_categoryAuthoringExtension); } - private class SpecificClassParameter extends ClassParameter { + // /////////////////////////////////////////// + // publishToFile package related configuration + // /////////////////////////////////////////// - private Class m_requiredClass; - - public SpecificClassParameter(final String name, - final int multiplicity, - final Object defaultObj, - final Class requiredClass) { - super(name, multiplicity, defaultObj); - m_requiredClass = requiredClass; - } - - // value != null - @Override - protected Object unmarshal(String value, ErrorList errors) { - Class theClass = (Class) super.unmarshal(value,errors); - if (theClass != null) { - if (!m_requiredClass.isAssignableFrom(theClass)) { - errors.add(new ParameterError(this, "class " + value + - " must implement : " + - m_requiredClass.getName())); - } - } - - return theClass; - } + // Moved to publishToFile.PublishToFileConfig! Temporarily retained here + // for backwards compatibility + public final boolean getDisableItemPfs() { + // return ((Boolean) get(m_disableItemPfs)).booleanValue(); + return PublishToFileConfig.getConfig().isItemPfsDisabled(); } + public final Class getPublishToFileClass() { + // return (Class) get(m_publishToFileClass); + return PublishToFileConfig.getConfig().getPublishListenerClass(); + } + + + + + + private class DHTMLEditorConfigParameter extends StringParameter { public DHTMLEditorConfigParameter(final String name, final int multiplicity, @@ -714,7 +714,7 @@ public final class ContentSectionConfig extends AbstractConfig { /** * for the given content type, returns a collection of - * step that are deemed irrelevant for the type. + * steps that are deemed irrelevant for the type. * * If no irrelevant steps, an empty set is returned. * diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties index 348ed9630..a0c209361 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties +++ b/ccm-cms/src/com/arsdigita/cms/ContentSectionConfig_parameter.properties @@ -18,16 +18,6 @@ com.arsdigita.cms.languages.purpose=The list of languages for this installation. com.arsdigita.cms.languages.example=en,de,fr,nl,it,pt,es com.arsdigita.cms.languages.format=[string] -com.arsdigita.cms.publish_to_file_class.title=Publish to File listener class -com.arsdigita.cms.publish_to_file_class.purpose=Class implementing PublishToFileListener. Contains the initial methods called when publishing or unpublishing. Normally this should be set to com.arsdigita.cms.publishToFile.PublishToFile, but custom classes can also be used. -com.arsdigita.cms.publish_to_file_class.example=com.arsdigita.cms.publishToFile.PublishToFile -com.arsdigita.cms.publish_to_file_class.format=[class] - -com.arsdigita.cms.disable_item_pfs.title=Disable (non-Template) Item p2fs -com.arsdigita.cms.disable_item_pfs.purpose=Disable publish-to-filesystem for items other than templates. (note: this parameter is a temporary measure to allow limited parameter-based control of p2fs until MapParameter is fully implemented) -com.arsdigita.cms.disable_item_pfs.example=false -com.arsdigita.cms.disable_item_pfs.format=[boolean] - com.arsdigita.cms.default_item_resolver_class.title=Item resolver class com.arsdigita.cms.default_item_resolver_class.purpose=Default item resolver class will be used for any content section which does not override in SectionInitializer enterprise.init section. This class must implement com.arsdigita.cms.dispatcher.ItemResolver. com.arsdigita.cms.default_item_resolver_class.example=com.arsdigita.cms.dispatcher.MultilingualItemResolver diff --git a/ccm-cms/src/com/arsdigita/cms/Initializer.java b/ccm-cms/src/com/arsdigita/cms/Initializer.java index 9bdef0caa..720fcbab7 100755 --- a/ccm-cms/src/com/arsdigita/cms/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/Initializer.java @@ -106,9 +106,6 @@ public class Initializer extends CompoundInitializer { /** * Initializes domain-coupling machinery, usually consisting of * registering object instantiators and observers. - * - * This starts up the search threads according to the values in the - * properties file */ public void init(DomainInitEvent e) { super.init(e); @@ -174,20 +171,6 @@ public class Initializer extends CompoundInitializer { new TraversalHandler()); - // Just set the class implementing methods run when for publishing - // or unpublishing to file. No initialisation of the class here. - try { - QueueManager.setListener((PublishToFileListener) - ContentSection.getConfig() - .getPublishToFileClass().newInstance()); - } catch (InstantiationException ex) { - throw new UncheckedWrapperException - ("Failed to instantiate the listener class", ex); - } catch (IllegalAccessException ex) { - throw new UncheckedWrapperException - ("Couldn't access the listener class", ex); - } - MetadataProviderRegistry.registerAdapter( FileAsset.BASE_DATA_OBJECT_TYPE, new AssetMetadataProvider()); diff --git a/ccm-cms/src/com/arsdigita/cms/enterprise.init b/ccm-cms/src/com/arsdigita/cms/enterprise.init index d0f6f32e6..ab09fc9f1 100755 --- a/ccm-cms/src/com/arsdigita/cms/enterprise.init +++ b/ccm-cms/src/com/arsdigita/cms/enterprise.init @@ -87,6 +87,11 @@ init com.arsdigita.cms.installer.SectionInitializer { // Name of the content section. This is used as the URL // so it must contain only characters that are allowed in URLs e.g., // no spaces. + // If you modify the name you must adjust: + // - Parameter m_defaultSection in c.ad.cms.ContentSectionConfig.java + // - Parameter waf.pagemap.login_redirect=content/content-center-redirect.jsp + // in integrations.properties of the respective bundle + // - registerDomain(navigationKey, "/content/", null); in ldn.aplaws.Loader name = "content"; // List of roles to create. First field is role name, @@ -123,6 +128,16 @@ init com.arsdigita.cms.installer.SectionInitializer { }; // List of content types to register + + // Example: + // { + // "com.arsdigita.cms.contenttypes.Address", + // "com.arsdigita.cms.contenttypes.Article", + // "com.arsdigita.cms.contenttypes.Contact" + // } + // The types are registered when the content-section is created. Later + // modifications have no effect. + types = { }; diff --git a/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java b/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java index a5bd7ea53..366d694f2 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java @@ -200,11 +200,13 @@ public final class ContentSectionSetup { } if (templateResolverClass != null && templateResolverClass.length()>0) { m_section.setTemplateResolverClass(templateResolverClass); - s_log.info("Registering " + templateResolverClass + " as the template resolver class"); + s_log.info("Registering " + templateResolverClass + + " as the template resolver class"); } else { m_section.setTemplateResolverClass (ContentSection.getConfig().getDefaultTemplateResolverClass().getName()); - s_log.info("Registering " + templateResolverClass + " as the template resolver class"); + s_log.info("Registering " + templateResolverClass + + " as the template resolver class"); } m_section.save(); @@ -215,12 +217,14 @@ public final class ContentSectionSetup { // The 3-step production workflow. WorkflowTemplate wf = new WorkflowTemplate(); - wf.setLabel( (String) GlobalizationUtil.globalize("cms.installer.production_workflow").localize()); + wf.setLabel( (String) GlobalizationUtil.globalize( + "cms.installer.production_workflow").localize()); wf.setDescription("A process that involves creating and approving content."); wf.save(); CMSTask authoring = new CMSTask(); - authoring.setLabel((String) GlobalizationUtil.globalize("cms.installer.authoring").localize()); + authoring.setLabel((String) GlobalizationUtil.globalize( + "cms.installer.authoring").localize()); authoring.setDescription("Create content."); authoring.save(); @@ -233,7 +237,8 @@ public final class ContentSectionSetup { authoring.save(); CMSTask approval = new CMSTask(); - approval.setLabel( (String) GlobalizationUtil.globalize("cms.installer.approval").localize()); + approval.setLabel( (String) GlobalizationUtil.globalize( + "cms.installer.approval").localize()); approval.setDescription("Approve content."); approval.save(); approval.addDependency(authoring); @@ -248,7 +253,8 @@ public final class ContentSectionSetup { CMSTask deploy = new CMSTask(); - deploy.setLabel((String) GlobalizationUtil.globalize("cms.installer.deploy").localize()); + deploy.setLabel((String) GlobalizationUtil.globalize( + "cms.installer.deploy").localize()); deploy.setDescription("Deploy content."); deploy.save(); deploy.addDependency(approval); @@ -281,11 +287,14 @@ public final class ContentSectionSetup { PrivilegeDescriptor.get("cms_read_item")); - String email = Boolean.TRUE.equals(pub) ? "public@nullhost" : "registered@nullhost"; + String email = Boolean.TRUE.equals(pub) ? "public@nullhost" + : "registered@nullhost"; Party viewer = retrieveParty(email); if (viewer == null) - throw new InitializationException( (String) GlobalizationUtil.globalize("cms.installer.cannot_find_group_for_email").localize() + email); + throw new InitializationException( + (String) GlobalizationUtil.globalize( + "cms.installer.cannot_find_group_for_email").localize() + email); s_log.info("Adding " + email + " to viewers role"); viewers.getGroup().addMemberOrSubgroup(viewer); @@ -333,18 +342,22 @@ public final class ContentSectionSetup { try { type = ContentType.findByAssociatedObjectType(name); } catch (DataObjectNotFoundException ex) { - throw new UncheckedWrapperException( (String) GlobalizationUtil.globalize("cms.installer.cannot_find_content_type").localize() + name, ex); + throw new UncheckedWrapperException( + (String) GlobalizationUtil.globalize( + "cms.installer.cannot_find_content_type").localize() + name, ex); } s_log.info("Adding type " + name + " to " + m_section.getDisplayName()); m_section.addContentType(type); - s_log.info("Setting the default lifecycle for " + name + " to " + m_lcd.getLabel()); + s_log.info("Setting the default lifecycle for " + + name + " to " + m_lcd.getLabel()); ContentTypeLifecycleDefinition. updateLifecycleDefinition(m_section, type, m_lcd); m_lcd.save(); - s_log.info("Setting the default workflow template for " + name + " to " + m_wf.getLabel()); + s_log.info("Setting the default workflow template for " + name + + " to " + m_wf.getLabel()); ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf); m_wf.save(); @@ -392,7 +405,9 @@ public final class ContentSectionSetup { try { line = input.readLine(); } catch (IOException ex) { - throw new UncheckedWrapperException( (String) GlobalizationUtil.globalize("cms.installer.cannot_read_line_of_data").localize(), ex); + throw new UncheckedWrapperException( + (String) GlobalizationUtil.globalize( + "cms.installer.cannot_read_line_of_data").localize(), ex); } if (line == null) break; @@ -418,7 +433,8 @@ public final class ContentSectionSetup { // The feature lifecycle. LifecycleDefinition lcd = new LifecycleDefinition(); - lcd.setLabel( (String) GlobalizationUtil.globalize("cms.installer.simple_publication").localize()); + lcd.setLabel( (String) GlobalizationUtil.globalize( + "cms.installer.simple_publication").localize()); lcd.setDescription("A one-phase lifecycle for items."); lcd.save(); @@ -549,20 +565,24 @@ public final class ContentSectionSetup { } } - public Timer startNotifierTask(Boolean sendOverdue, Integer duration, Integer alertInterval, Integer max) { + public Timer startNotifierTask(Boolean sendOverdue, Integer duration, + Integer alertInterval, Integer max) { Timer unfinished = null; if (sendOverdue.booleanValue()) { if (duration == null || alertInterval == null || max == null) { - s_log.info("Not sending overdue task alerts, required initialization parameters were not specified"); + s_log.info("Not sending overdue task alerts, " + + "required initialization parameters were not specified"); return null; } // start the Timer as a daemon, so it doesn't keep the JVM from exiting unfinished = new Timer(true); - UnfinishedTaskNotifier notifier = new UnfinishedTaskNotifier(m_section, duration.intValue(), + UnfinishedTaskNotifier notifier = new UnfinishedTaskNotifier( + m_section, duration.intValue(), alertInterval.intValue(), max.intValue()); // schedule the Task to start in 5 minutes, at 1 hour intervals unfinished.schedule(notifier, 5L * 60 * 1000, 60L * 60 * 1000); - s_log.info("Sending overdue alerts for tasks greater than " + duration + " hours old"); + s_log.info("Sending overdue alerts for tasks greater than " + + duration + " hours old"); } else { s_log.info("Not sending overdue task alerts"); } diff --git a/ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java b/ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java index 6bad7ce30..14aae18ce 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/SectionInitializer.java @@ -170,7 +170,9 @@ public class SectionInitializer extends com.arsdigita.kernel.BaseInitializer { try { node = SiteNode.getSiteNode("/" + name); } catch (DataObjectNotFoundException ex) { - throw new InitializationException( (String) GlobalizationUtil.globalize("cms.installer.root_site_node_missing").localize(), ex); + throw new InitializationException( + (String) GlobalizationUtil.globalize( + "cms.installer.root_site_node_missing").localize(), ex); } ContentSection section = null; if ( rootNodeID.equals(node.getID()) ) { @@ -180,7 +182,10 @@ public class SectionInitializer extends com.arsdigita.kernel.BaseInitializer { try { section = ContentSection.getSectionFromNode(node); } catch (DataObjectNotFoundException de) { - throw new InitializationException( (String) GlobalizationUtil.globalize("cms.installer.could_not_load_section", new Object[] {name}).localize(), de); + throw new InitializationException( + (String) GlobalizationUtil.globalize( + "cms.installer.could_not_load_section", + new Object[] {name}).localize(), de); } } return section; diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java index d59ba4a21..8ea97429d 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/Duration.java @@ -25,13 +25,10 @@ import com.arsdigita.util.Assert; * * @author Michael Pih (pihman@arsdigita.com) * @version $Revision: #11 $ $Date: 2004/08/17 $ + * @version $Id: Duration.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Duration { - public static final String versionId = - "$Id: Duration.java 287 2005-02-22 00:29:02Z sskracic $" + - " by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - /** * A convenience wrapper around {@link #formatDuration(int)}. * diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/Lifecycle.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/Lifecycle.java index f46d61e97..d3328b180 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/Lifecycle.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/Lifecycle.java @@ -22,7 +22,7 @@ import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.kernel.ACSObject; import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataAssociationCursor; -import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.Filter; @@ -43,13 +43,12 @@ import java.util.Date; * * @author Jack Chung * @author Michael Pih - * @version $Revision: 1.1 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Revision: 1.1 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: Lifecycle.java 1585 2007-05-29 13:12:44Z chrisgilbert23 $ */ public class Lifecycle extends ACSObject { - public static final String versionId = "$Id: Lifecycle.java 1585 2007-05-29 13:12:44Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/17 23:15:09 $"; - public final static String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.Lifecycle"; @@ -132,23 +131,23 @@ public class Lifecycle extends ACSObject { } - - public void beforeDelete() { - s_log.debug("About to delete lifecycle " + getID() + ". First delete phases & LifecycleService"); - super.beforeDelete(); - DataCollection lifecycleServices = SessionManager.getSession().retrieve(LifecycleService.BASE_DATA_OBJECT_TYPE); - lifecycleServices.addEqualsFilter(LifecycleService.LIFECYCLE_ID, getID()); - while (lifecycleServices.next()) { - DataObject service = lifecycleServices.getDataObject(); - s_log.debug("Deleting lifecycle service " + service.getOID()); - // we are deleting the lifecycle so delete all connections from cycle to acs objects if more than one - service.delete(); - } - PhaseCollection phases = getPhases(); - while (phases.next()) { - phases.getPhase().delete(false); - } - } + + public void beforeDelete() { + s_log.debug("About to delete lifecycle " + getID() + ". First delete phases & LifecycleService"); + super.beforeDelete(); + DataCollection lifecycleServices = SessionManager.getSession().retrieve(LifecycleService.BASE_DATA_OBJECT_TYPE); + lifecycleServices.addEqualsFilter(LifecycleService.LIFECYCLE_ID, getID()); + while (lifecycleServices.next()) { + DataObject service = lifecycleServices.getDataObject(); + s_log.debug("Deleting lifecycle service " + service.getOID()); + // we are deleting the lifecycle so delete all connections from cycle to acs objects if more than one + service.delete(); + } + PhaseCollection phases = getPhases(); + while (phases.next()) { + phases.getPhase().delete(false); + } + } /** * Fetches the label of the lifecycle, which is the same as the * label of the associated lifecycle definition. diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinition.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinition.java index d400afb7f..2ba7b3a81 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinition.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinition.java @@ -39,12 +39,9 @@ import java.util.Date; * @author Jack Chung (flattop@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com) * @version $Revision: #14 $ $Date: 2004/08/17 $ + * @version $Id: LifecycleDefinition.java 287 2005-02-22 00:29:02Z sskracic $ */ public class LifecycleDefinition extends ACSObject { - public static final String versionId = - "$Id: LifecycleDefinition.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/17 23:15:09 $"; private static Logger s_log = Logger.getLogger(LifecycleDefinition.class); diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinitionCollection.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinitionCollection.java index 74ea9f811..23dc636d7 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinitionCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleDefinitionCollection.java @@ -24,17 +24,15 @@ import com.arsdigita.persistence.DataCollection; /** * This class contains a collection fo Lifecycle Definition + * @see DomainCollection + * @see DataCollection * * @author Jack Chung (flattop@arsdigita.com) * @version $Revision: #8 $ $Date: 2004/08/17 $ - * - * @see DomainCollection - * @see DataCollection + * @version $Id: LifecycleDefinitionCollection.java 287 2005-02-22 00:29:02Z sskracic $ */ public class LifecycleDefinitionCollection extends DomainCollection { - public static final String versionId = "$Id: LifecycleDefinitionCollection.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - /** * Constructor. * diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleEvent.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleEvent.java index 444a55613..bedd45211 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleEvent.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleEvent.java @@ -29,11 +29,11 @@ import java.util.Date; * * @author Jack Chung (flattop@arsdigita.com) * @version $Revision: #9 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: LifecycleEvent.java 287 2005-02-22 00:29:02Z sskracic $ */ public class LifecycleEvent { - public static final String versionId = "$Id: LifecycleEvent.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; private int m_eventType; private Date m_startDateTime, m_endDateTime; private OID m_oid; diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleListener.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleListener.java index da31edc2d..7ff0b568e 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleListener.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleListener.java @@ -25,12 +25,12 @@ package com.arsdigita.cms.lifecycle; * * @author Jack Chung (flattop@arsdigita.com) * @version $Revision: #7 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: LifecycleListener.java 287 2005-02-22 00:29:02Z sskracic $ */ public interface LifecycleListener { - public static final String versionId = "$Id: LifecycleListener.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; /** * Invoked when an lifecycle or phase begins. If any runtime exception is * thrown, the transaction will be aborted. diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java index 0deccd312..783573171 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/LifecycleService.java @@ -40,12 +40,11 @@ import java.sql.SQLException; * * @author Jack Chung (flattop@arsdigita.com) * @version $Revision: #13 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: LifecycleService.java 287 2005-02-22 00:29:02Z sskracic $ */ public class LifecycleService extends DomainObject{ - public static final String versionId = "$Id: LifecycleService.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; - private static final Logger s_log = Logger.getLogger(LifecycleService.class); public static final String BASE_DATA_OBJECT_TYPE = diff --git a/ccm-cms/src/com/arsdigita/cms/lifecycle/Phase.java b/ccm-cms/src/com/arsdigita/cms/lifecycle/Phase.java index a321124a7..bdb7ae2d6 100755 --- a/ccm-cms/src/com/arsdigita/cms/lifecycle/Phase.java +++ b/ccm-cms/src/com/arsdigita/cms/lifecycle/Phase.java @@ -37,13 +37,12 @@ import java.util.Date; * * @author Jack Chung (flattop@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com) - * @version $Revision: 1.1 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Revision: 1.1 $ $DateTime: 2004/08/17 23:15:09 $ + * @version $Id: Phase.java 1583 2007-05-25 15:32:13Z chrisgilbert23 $ */ public class Phase extends ACSObject { - public static final String versionId = "$Id: Phase.java 1583 2007-05-25 15:32:13Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/17 23:15:09 $"; - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.Phase"; @@ -65,10 +64,10 @@ public class Phase extends ACSObject { private static final Logger s_log = Logger.getLogger(Phase.class); - // temporarily stored during delete cycle - private PhaseDefinition m_definition = null; - private boolean m_updateCycleTimes = true; - + // temporarily stored during delete cycle + private PhaseDefinition m_definition = null; + private boolean m_updateCycleTimes = true; + /** * If this constructor is used, the phase definition needs to be * set with the setPhaseDefinition method. @@ -328,30 +327,30 @@ public class Phase extends ACSObject { } - public void delete (boolean updateCycleTimes) { - m_updateCycleTimes = updateCycleTimes; - delete(); - - } - - public void beforeDelete () { - s_log.debug("About to delete phase " + getID()); - super.beforeDelete(); - Lifecycle cycle = getLifecycle(); - if ( cycle != null ) { - PhaseDefinition definition = getPhaseDefinition(); - PhaseDefinitionCollection cyclePhaseDefinitions = cycle.getLifecycleDefinition().getPhaseDefinitions(); - cyclePhaseDefinitions.addEqualsFilter(PhaseDefinition.ID, definition.getID()); - if (cyclePhaseDefinitions.isEmpty()) { - s_log.debug("Phase Definition " + definition.getID() + ": " + definition.getLabel() + " is a custom phase definition. I will delete it after deleting phase " + getID()); - // this is a custom definition - delete it once phase has been deleted - m_definition = definition; - } - - - - } - } + public void delete (boolean updateCycleTimes) { + m_updateCycleTimes = updateCycleTimes; + delete(); + + } + + public void beforeDelete () { + s_log.debug("About to delete phase " + getID()); + super.beforeDelete(); + Lifecycle cycle = getLifecycle(); + if ( cycle != null ) { + PhaseDefinition definition = getPhaseDefinition(); + PhaseDefinitionCollection cyclePhaseDefinitions = cycle.getLifecycleDefinition().getPhaseDefinitions(); + cyclePhaseDefinitions.addEqualsFilter(PhaseDefinition.ID, definition.getID()); + if (cyclePhaseDefinitions.isEmpty()) { + s_log.debug("Phase Definition " + definition.getID() + ": " + definition.getLabel() + " is a custom phase definition. I will delete it after deleting phase " + getID()); + // this is a custom definition - delete it once phase has been deleted + m_definition = definition; + } + + + + } + } /** * Delete this phase, updating the start and end times of the * associated lifecycle. @@ -359,17 +358,17 @@ public class Phase extends ACSObject { public void delete() { Lifecycle cycle = getLifecycle(); super.delete(); - if ( cycle != null && m_updateCycleTimes) { + if ( cycle != null && m_updateCycleTimes) { cycle.updateStartEndTimes(); } } - public void afterDelete() { - if (m_definition != null) { - m_definition.delete(); - } - } - + public void afterDelete() { + if (m_definition != null) { + m_definition.delete(); + } + } + protected void afterSave() { super.afterSave(); Lifecycle cycle = getLifecycle(); diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java index 18125721a..f5fea50c4 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java @@ -18,14 +18,33 @@ */ package com.arsdigita.cms.publishToFile; +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.Template; import com.arsdigita.db.DbHelper; + +import com.arsdigita.domain.DomainObject; +// import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectInstantiator; + +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.metadata.MetadataRoot; +import com.arsdigita.persistence.metadata.ObjectType; +import com.arsdigita.runtime.CCMResourceManager; import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.ConfigError; import com.arsdigita.runtime.ContextCloseEvent; -import com.arsdigita.runtime.DataInitEvent; +import com.arsdigita.runtime.ContextInitEvent; +// import com.arsdigita.runtime.DataInitEvent; import com.arsdigita.runtime.DomainInitEvent; -import com.arsdigita.runtime.LegacyInitEvent; +// import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.runtime.LegacyInitializer; import com.arsdigita.runtime.RuntimeConfig; +import com.arsdigita.util.UncheckedWrapperException; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Iterator; import org.apache.log4j.Logger; @@ -40,22 +59,22 @@ import org.apache.log4j.Logger; */ public class Initializer extends CompoundInitializer { - // Creates a s_logging category with name = to the full name of class + /** + * Creates a s_logging category with name = to the full name of class + */ private static Logger s_log = Logger.getLogger(Initializer.class); + private static PublishToFileConfig s_conf= PublishToFileConfig.getConfig(); public Initializer() { final String url = RuntimeConfig.getConfig().getJDBCURL(); final int database = DbHelper.getDatabaseFromURL(url); - // Left over from CMS initializer - // add(new PDLInitializer - // (new ManifestSource - // ("ccm-cms.pdl.mf", - // new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); - - add(new LegacyInitializer("com/arsdigita/cms/publishToFile/enterprise.init")); + // temporary solution for the time LegacyInitializer is not completely + // migrated to this Initializer + // add(new LegacyInitializer("com/arsdigita/cms/publishToFile/enterprise.init")); + // s_conf = PublishToFileConfig.getConfig(); } /** @@ -63,17 +82,49 @@ public class Initializer extends CompoundInitializer { * * @param evt The data init event. */ - public void init(DataInitEvent evt) { - } +// public void init(DataInitEvent evt) { +// } /** * Initializes domain-coupling machinery, usually consisting of * registering object instantiators and observers. * - * In the future: This starts up the search threads according to the values in the - * properties file */ public void init(DomainInitEvent e) { + s_log.debug("publishToFile.Initializer.init(DomainInitEvent) invoked"); + + // Recursive invokation of init, is it really necessary?? + // On the other hand: + // An empty implementations prevents this initializer from being executed. + // A missing implementations causes the super class method to be executed, + // which invokes the above added LegacyInitializer. + // If super is not invoked, various other cms sub-initializer may not run. + super.init(e); + +/* From old Initializer system + * DomainObjectInstantiator inst = new DomainObjectInstantiator() { + * public DomainObject doNewInstance(DataObject dobj) { + * return new PublishedFile(dobj); + * } + * }; + * DomainObjectFactory.registerInstantiator( + * PublishedFile.BASE_DATA_OBJECT_TYPE, + * inst); + */ + e.getFactory().registerInstantiator + (PublishedFile.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new PublishedFile(dataObject); + } + public DomainObjectInstantiator + resolveInstantiator(DataObject obj) { + return this; + } + }); + + // Not really handling domain registration but preparing the domain + processDestination((ArrayList) s_conf.getPublishDestinations()); } @@ -82,8 +133,67 @@ public class Initializer extends CompoundInitializer { * * @param evt The legacy init event. */ - public void init(LegacyInitEvent evt) {} +// An empty implementations prevents this initializer from beiong executed. +// A missing implementations causes the super class method to be executed, which +// invokes the above added LegacyInitializer. +// That initializer starts P2fs background thread and creation of +// ~/packages/content-section/templates/content works now. +// public void init(LegacyInitEvent evt) {} + /** + * Implementation of the {@link Initializer#init(ContextInitEvent)} method + * used to setup and start background threads which synchronize the content + * stored in the database (all modifications made using the CMS module are + * persisted in database) with the file system. + * + * @param evt The context init event. + **/ + public void init(ContextInitEvent evt) { + s_log.debug("publishToFile.Initializer.init(ContextInitEvent) invoked"); + + // Recursive invokation of init, is it really necessary?? + // On the other hand: + // An empty implementations prevents this initializer from being executed. + // A missing implementations causes the super class method to be executed, + // which invokes the above added LegacyInitializer. + // If super is not invoked, various other cms sub-initializer may not run. + super.init(evt); + + PublishToFile.setRequestTimeout(s_conf.getRequestTimeout()); + QueueManager.setRetryDelay(s_conf.getRetryDelay()); + QueueManager.setBlockSize(s_conf.getBlockSize()); + QueueManager.setBlockSelectMethod(s_conf.getBlockSelectMethod()); + QueueManager.setMaximumFailCount(s_conf.getMaximumFailCount()); + + + // Set the class implementing methods run when for publishing + // or unpublishing to file. + try { + QueueManager.setListener((PublishToFileListener) + s_conf.getPublishListenerClass() + .newInstance()); + } catch (InstantiationException ex) { + throw new UncheckedWrapperException + ("Failed to instantiate the listener class", ex); + } catch (IllegalAccessException ex) { + throw new UncheckedWrapperException + ("Couldn't access the listener class", ex); + } + + + // start thread for monitoring queue + // int startupDelay = s_conf.getStartupDelay(); + // int pollDelay = s_conf.getPollDelay(); + QueueManager.startWatchingQueue(s_conf.getStartupDelay(), + s_conf.getPollDelay()); + + QueueManager.requeueMissingFiles(); + + + s_log.debug("publishToFile.Initializer.init(ContextInitEvent) completed"); + } + + /** * Implementation of the {@link Initializer#close()} method. * @@ -94,11 +204,149 @@ public class Initializer extends CompoundInitializer { * @param evt The legacy init event. **/ public void close(ContextCloseEvent evt) { - s_log.info("publishToFile.Initializer.destroy() invoked"); + s_log.debug("publishToFile.Initializer.destroy() invoked"); QueueManager.stopWatchingQueue(); - s_log.info("publishToFile.Initializer.destroy() completed"); + s_log.debug("publishToFile.Initializer.destroy() completed"); } + + /** + * Process publishing destinations. + * @param dest + * @throws ConfigError + */ + private static void processDestination(ArrayList dest) + throws ConfigError { + if (dest == null) { + throw new ConfigError("publish destinations must not be null"); + } + if (dest.size() < 1) { + throw new ConfigError("publish destinations must contain at " + + "least one entry"); + } + + Iterator entries = dest.iterator(); + while (entries.hasNext()) { + processDestinationEntry((List)entries.next()); + } + } + + /** + * Processes one entry of the list of destinations. + * Helper method for {@see #processDestination}. + * + * @param entry + * @throws ConfigError + */ + private static void processDestinationEntry(List entry) + throws ConfigError { + + if ( entry.size() != 4 ) { + throw new ConfigError("publish destinations entry must contain " + + "four elements: '{ \n" + + " \"content type\",\n" + + " \"root directory\", \n" + + " \"is shared\", \n" + + " \"url stub\" \n" + + "};\n"); + } + + String contentType = (String)entry.get(0); + // destRoot is here relative to webapp root! + String destRoot = (String) entry.get(1); + Boolean sharedRoot = (Boolean) entry.get(2); + String destURL = (String) entry.get(3); + + if ( contentType == null || contentType.trim().length() == 0) { + throw new ConfigError("The destination content type must not be null"); + } + + ObjectType type = MetadataRoot.getMetadataRoot().getObjectType(contentType); + if (type == null) { + throw new ConfigError("The destination content type cannot be found"); + } + + if (destRoot == null || destRoot.trim().length() == 0) { + throw new ConfigError("The destination root must not be null"); + } + if (destRoot.endsWith("/")) { + throw new ConfigError("the destination root '" + destRoot + + "' must not end with a '/'"); + } + + // Does destRoot really now turns into an absolute fully pathname + destRoot = new File(CCMResourceManager.getBaseDirectory().getPath(), + destRoot).getPath(); + s_log.info("Destination Root is set to : " + destRoot); + + + + if (sharedRoot == null) { + throw new ConfigError("The destination shared flag must not be null"); + } + + + if (destURL == null || "".equals(destURL.trim())) { + throw new ConfigError("the destination URL must not be null"); + } + if (!destURL.startsWith("/")) { + throw new ConfigError("the destination URL '" + destURL + + "' must start with a '/'"); + } + if (destURL.endsWith("/")) { + throw new ConfigError("the destination URL '" + destURL + + "' must not end with a '/'"); + } + + DestinationStub dest = new DestinationStub(destRoot, + sharedRoot.booleanValue(), + destURL); + + File file = dest.getFile(); + if (!file.exists()) { + file.mkdirs(); + s_log.info(file.getPath() + " created"); + } + boolean writable = false; + FileWriter fl; + File fname = new File(file.getPath(),"placeholder.txt"); + s_log.info("Try to create : " + destRoot); + try { + writable = file.canWrite() && file.isDirectory(); + try { + fl = new FileWriter(fname.getPath()); + fl.write("Location for the p2fs module to store static content. \n"); + fl.close(); + } catch ( IOException e ) { + // Will be reported as an initalization error + s_log.warn("Error creating file " + fname.getPath()); + } + + + } catch ( SecurityException ex ) { + // Will be reported as an initalization error + } + if ( ! writable ) { + // HACK: Let's see if we can write to the config directory. If we can, + // then we're running as ccmadmin inside of ccm load, and there is no + // need to thrown an exception. + File conf = CCMResourceManager.getConfigDirectory(); + if (conf.isDirectory() && conf.canWrite()) { + // we're ok + } else { + throw new ConfigError(" the document root '" + file + +"' must be a writable directory"); + } + } + + if (Template.BASE_DATA_OBJECT_TYPE.equals(contentType) || + !s_conf.isItemPfsDisabled()) { + PublishToFile.addDestination(contentType, + dest); + } + } + + } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/LegacyInitializer.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/LegacyInitializer.java.nolongerInUse similarity index 85% rename from ccm-cms/src/com/arsdigita/cms/publishToFile/LegacyInitializer.java rename to ccm-cms/src/com/arsdigita/cms/publishToFile/LegacyInitializer.java.nolongerInUse index ff3f248f9..3948fb8cd 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/LegacyInitializer.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/LegacyInitializer.java.nolongerInUse @@ -35,6 +35,8 @@ import com.arsdigita.persistence.metadata.MetadataRoot; import com.arsdigita.persistence.metadata.ObjectType; import com.arsdigita.runtime.CCMResourceManager; +import com.arsdigita.util.UncheckedWrapperException; + import org.apache.log4j.Logger; @@ -141,9 +143,10 @@ public class LegacyInitializer implements com.arsdigita.initializer.Initializer TransactionContext txn = SessionManager.getSession().getTransactionContext(); txn.beginTxn(); + setupPublishToFileSystem(); - QueueManager.requeueMissingFiles(); + // QueueManager.requeueMissingFiles(); txn.commitTxn(); } @@ -157,6 +160,7 @@ public class LegacyInitializer implements com.arsdigita.initializer.Initializer * initialize source and destinations for publishing to the file system */ private void setupPublishToFileSystem() throws InitializationException { + DomainObjectInstantiator inst = new DomainObjectInstantiator() { public DomainObject doNewInstance(DataObject dobj) { return new PublishedFile(dobj); @@ -166,19 +170,37 @@ public class LegacyInitializer implements com.arsdigita.initializer.Initializer PublishedFile.BASE_DATA_OBJECT_TYPE, inst); + // PublishToFileConfig ptfConf = PublishToFileConfig.getConfig(); - processDestination((List) m_conf.getParameter(PUBLISH_DESTINATIONS)); - PublishToFile.setRequestTimeout(getInteger(REQUEST_TIMEOUT).intValue()); + // processDestination((List) m_conf.getParameter(PUBLISH_DESTINATIONS)); + // processDestination((List) ptfConf.getPublishDestinations()); + // setupQueueManager(); - QueueManager.setRetryDelay(getInteger(RETRY_DELAY)); - QueueManager.setBlockSize(getInteger(BLOCK_SIZE)); - QueueManager.setBlockSelectMethod(getString(BLOCK_SELECT_METHOD)); - QueueManager.setMaximumFailCount(getInteger(MAXIMUM_FAIL_COUNT)); + } + + /** + * Prepare Queuemanager and start Queue processing. + */ + private void setupQueueManager(){ + + PublishToFileConfig ptfConf = PublishToFileConfig.getConfig(); + + // PublishToFile.setRequestTimeout(getInteger(REQUEST_TIMEOUT).intValue()); + PublishToFile.setRequestTimeout(ptfConf.getRequestTimeout()); + + // QueueManager.setRetryDelay(getInteger(RETRY_DELAY)); + QueueManager.setRetryDelay(ptfConf.getRetryDelay()); + // QueueManager.setBlockSize(getInteger(BLOCK_SIZE)); + QueueManager.setBlockSize(ptfConf.getBlockSize()); + // QueueManager.setBlockSelectMethod(getString(BLOCK_SELECT_METHOD)); + QueueManager.setBlockSelectMethod(ptfConf.getBlockSelectMethod()); + // QueueManager.setMaximumFailCount(getInteger(MAXIMUM_FAIL_COUNT)); + QueueManager.setMaximumFailCount(ptfConf.getMaximumFailCount()); // setup listener if specified - String listenerName = getString( PUBLISH_TO_FILE_LISTENER ); +/* String listenerName = getString( PUBLISH_TO_FILE_LISTENER ); if (listenerName != null) { PublishToFileListener listener = null; Class listenerClass = null; @@ -202,13 +224,30 @@ public class LegacyInitializer implements com.arsdigita.initializer.Initializer } QueueManager.setListener(listener); } +*/ + // Just set the class implementing methods run when for publishing + // or unpublishing to file. No initialisation of the class here. + try { + QueueManager.setListener((PublishToFileListener) + ptfConf.getpublishListenerClass() + .newInstance()); + } catch (InstantiationException ex) { + throw new UncheckedWrapperException + ("Failed to instantiate the listener class", ex); + } catch (IllegalAccessException ex) { + throw new UncheckedWrapperException + ("Couldn't access the listener class", ex); + } + // start thread for monitoring queue - int startupDelay = getInteger(QUEUE_POLL_STARTUP_DELAY).intValue(); - int pollDelay = getInteger(QUEUE_POLL_DELAY).intValue(); + // int startupDelay = getInteger(QUEUE_POLL_STARTUP_DELAY).intValue(); + int startupDelay = ptfConf.getStartupDelay(); + // int pollDelay = getInteger(QUEUE_POLL_DELAY).intValue(); + int pollDelay = ptfConf.getPollDelay(); QueueManager.startWatchingQueue(startupDelay, pollDelay); - } + } // // Process publishing destinations // diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java index 940e8169a..8bd59be86 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java @@ -67,6 +67,7 @@ public class PublishToFile implements PublishToFileListener { Logger.getLogger(PublishToFile.class); // Queue entry timeout + // TODO: pickup value from configuration file as a single source! private static int s_timeout = DEFAULT_TIMEOUT; private static Map s_destinations = new HashMap(); diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java index 2b3ba1eea..9062c98bf 100644 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java @@ -19,21 +19,29 @@ package com.arsdigita.cms.publishToFile; import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.ClassParameter; import com.arsdigita.util.parameter.IntegerParameter; import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.SpecificClassParameter; import com.arsdigita.util.parameter.StringParameter; +// import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; + import org.apache.log4j.Logger; + +// STATUS: All parameter and its values copied from the old Initializer class +// and from enterprise.init file. +// Temporary solution for m_destinations (destinations for published content +// items and template), returned as constant list. + + /** * Configuration object for the publish-to-file service. * - * UNFINISHED WORK - NOT USABLE YET! - * ToDO: Parameter destination is a list, but we have no ListParameter type for now. - * We have either to develop a ListParameter class or treat this parameter as - * a set of StringArrayParameter. - * * @author Peter Boy <pboy@barkhof.uni-bremen.de> * @version $Id: $ */ @@ -43,32 +51,60 @@ public class PublishToFileConfig extends AbstractConfig { private static PublishToFileConfig s_conf; + /** + * Temporary, constant list of publish destinations. It is intended as a + * temporary fix until we have a configurable pramameter + * {@see #m_destinations} and {@see #getPublishDestinations()}. + * Should be replaced and removed then. + */ + private static ArrayList s_tmpDestList; + + /** + * Disable publish-to-filesystem for items other than templates. + * NOTE: Templates are stored in the database and must be synchronized with + * the filesystem in order to be used. Therefore publish-to filesystem must + * not deactivated at all. + */ + // Moved from ContentSectionConfig where this parameter was a temporary measure + // to allow limited parameter-based control of p2fs until MapParameter, + // which was intended to replace old Initilizer system's parameter + // implementation, is fully implemented) + private final Parameter m_disableItemPfs; + /** * List of publish destinations for content types. - * Each element is a four-element list in the format + * Each list element is itself a four-element list in the format * { "content type", "root directory", "shared storage", "url stub" }. * * Content type is the object type of the content type. - * Root directory must be a path to a writable directory, relative to the - * webapp root. + * Root directory must be a path to a writable directory, relative to + * webapp root(!). * Shared storage must be true if the root directory is shared NFS storage, * false otherwise. - * URL stub is the path component of the URL from which the live + * URL stub is the path componen3t of the URL from which the live * server will serve from this directory. */ - private final Parameter m_destination; + // ToDO: Parameter destination is a list, but we have no ListParameter type + // for now. We have either to develop a ListParameter class or treat this + // parameter as a set of StringArrayParameter. + // Another possibility considered was MapParameter + private final Parameter m_destinations; /** - * Class which implements PublishToFileListener used to perform + * Class implementing PublishToFileListener Interface. + * + * Contains the initial methods called when publishing or unpublishing. It + * is usually be set to com.arsdigita.cms.publishToFile.PublishToFile, + * but custom classes can also be used. That can be used to perform * additional actions when publishing or unpublishing to the file system. */ - private final Parameter m_publishListener; + private final Parameter m_publishToFileListenerClass; /** * Time (in seconds) after system startup to wait before starting to monitor * publishToFile queue. * - * Set startupDelay to 0 to disable the processing of the queue. This + * Set startupDelay to 0 (< 0) to disable the processing of the queue. This * disables the processing of templates as well so it will affect a basic * functionality of the system and is not recommended under normal * conditions. @@ -76,7 +112,7 @@ public class PublishToFileConfig extends AbstractConfig { private final Parameter m_startupDelay; /** - * Time (in seconds) between checking if there are entries in the + * Time (in seconds) between checking whether there are entries in the * publishToFile queue. * * A value <= 0 disables processing the queue on this server. @@ -97,6 +133,16 @@ public class PublishToFileConfig extends AbstractConfig { * Number of queue entries to process at once. */ private final Parameter m_blockSize; + + /** + * Method used to select entries for processing. + * 'QueuedOrder' - in queued order. + * 'GroupByParent'- group entries according to parent when selecting items + * (allows optimizations if a listener task required for + * all elements in a folder can be done only once for the + * folder). + */ + private final Parameter m_blockSelectMethod; /** * Number of times a failed queue entry will be reprocessed. @@ -106,16 +152,6 @@ public class PublishToFileConfig extends AbstractConfig { * The default value -1 will ignore this parameter. */ private final Parameter m_maximumFailCount; - - /** - * Method used to select entries for processing. - * 'QueuedOrder' - in queued order. - * 'GroupByParent'- group entries according to parent when selecting items - * (allows optimizations if a listener task required for - * all elements in a folder can be done only once for the - * folder). - */ - private final Parameter m_blockSelectMethod; @@ -126,7 +162,7 @@ public class PublishToFileConfig extends AbstractConfig { * the constructor directly. * @return */ - static synchronized PublishToFileConfig getConfig() { + public static synchronized PublishToFileConfig getConfig() { if (s_conf == null) { s_conf = new PublishToFileConfig(); s_conf.load(); @@ -142,22 +178,19 @@ public class PublishToFileConfig extends AbstractConfig { */ public PublishToFileConfig() { - /** - * List of publish destinations for content types. - * Each element is a four-element list in the format - * { "content type", "root directory", "shared storage", "url stub" }. - * - * Content type is the object type of the content type. - * Root directory must be a path to a writable directory, relative to the - * webapp root. - * Shared storage must be true if the root directory is shared NFS storage, - * false otherwise. - * URL stub is the path component of the URL from which the live - * server will serve from this directory. - */ - // Unfinished work! Not usable! + // Initialize field values + + // Notice: Default now TRUE! Had previously be false. + // Parameter renamed and relocated, Adaptation of installation bundles + // required (version 6.0.2). + m_disableItemPfs = new BooleanParameter + ("com.arsdigita.cms.publishToFile.disable_item_pfs", + Parameter.REQUIRED, new Boolean(true)); + + // m_destinations is unfinished work! Not usable! // Parameter is a list, but we have currently no ListParameter type. - m_destination = new StringParameter + // Others have considered to develop a MapParameter for it. + m_destinations = new StringParameter ("com.arsdigita.cms.publishToFile.destination", Parameter.REQUIRED, "{ " + " { 'com.arsdigita.cms.ContentItem', " + @@ -171,107 +204,136 @@ public class PublishToFileConfig extends AbstractConfig { "} " ); - /** - * Class which implements PublishToFileListener used to perform - * additional actions when publishing or unpublishing to the file system. - */ + // Originally (old initializer system): // publishListener = "com.arsdigita.cms.publishToFile.PublishToFile"; - m_publishListener = new ClassParameter - ("com.arsdigita.cms.publishToFile.publish_listener", Parameter.REQUIRED, - PublishToFile.class); + m_publishToFileListenerClass = new SpecificClassParameter + ("com.arsdigita.cms.publishToFile.publish_to_file_listener_class", + Parameter.REQUIRED, + PublishToFile.class, + PublishToFileListener.class); + // Queue management parameters. - /** - * Time (in seconds) after system startup to wait before starting to - * monitor publishToFile queue. - * - * Set startupDelay to 0 to disable the processing of the queue. This - * disables the processing of templates as well so it will affect a basic - * functionality of the system and is not recommended under normal - * conditions. - */ + m_startupDelay = new IntegerParameter ("com.arsdigita.cms.publishToFile.startup_delay", Parameter.REQUIRED, new Integer(30)); - /** - * Time (in seconds) between checking if there are entries in the - * publishToFile queue. - * - * A value <= 0 disables processing the queue on this server. - */ m_pollDelay = new IntegerParameter ("com.arsdigita.cms.publishToFile.poll_delay", Parameter.REQUIRED, new Integer(5)); - /** - * Time to wait (seconds) before retrying to process a failed entry - */ m_retryDelay = new IntegerParameter ("com.arsdigita.cms.publishToFile.retry_delay", Parameter.REQUIRED, new Integer(120)); - /** - * Time to wait (seconds) before aborting item request. - */ m_requestTimeout = new IntegerParameter ("com.arsdigita.cms.publishToFile.request_timeout", Parameter.REQUIRED, - new Integer(120)); + new Integer(60)); - /** - * Number of queue entries to process at once (in one transaction). - */ m_blockSize = new IntegerParameter ("com.arsdigita.cms.publishToFile.block_size", Parameter.REQUIRED, new Integer(40)); - /** - * Number of times a failed queue entry will be reprocessed. - * Maximum Fail Count for actions in Queue Manager. - * If Fail Count in database is more than specified limit, Queue Manager - * will ignore the action. - * A value -1 will ignore this parameter. - */ - m_maximumFailCount = new IntegerParameter - ("com.arsdigita.cms.publishToFile.maximum_fail_count", Parameter.REQUIRED, - new Integer(10)); - - /** - * Method used to select entries for processing. - * 'QueuedOrder' - in queued order. - * 'GroupByParent'- group entries according to parent when selecting items - * (allows optimizations if a listener task required for - * all elements in a folder can be done only once for the - * folder). - */ m_blockSelectMethod = new StringParameter ("com.arsdigita.cms.publishToFile.block_select_method", Parameter.REQUIRED, "GroupByParent"); + m_maximumFailCount = new IntegerParameter + ("com.arsdigita.cms.publishToFile.maximum_fail_count", Parameter.REQUIRED, + new Integer(10)); - register(m_destination); - register(m_publishListener); + + // Register parameters + + register(m_disableItemPfs); + // register(m_destinations); Unfinished; currently not usable + register(m_publishToFileListenerClass); register(m_startupDelay); register(m_pollDelay); register(m_retryDelay); register(m_requestTimeout); register(m_blockSize); - register(m_maximumFailCount); register(m_blockSelectMethod); + register(m_maximumFailCount); loadInfo(); } + /** + * Retrieve whether or not content items should be statically published + * (i.e. exported) into the filesystem. + * (Templates are always exported independently from this parameter because + * otherwise they are not accessible by the servlet container!) + * + * @return (boolean) m_disableItemPfs Parameter + */ + public final boolean isItemPfsDisabled() { + return ((Boolean) get(m_disableItemPfs)).booleanValue(); + } + + /** + * Retrieve list of publish destinations for content types. Each + * list element is itself a four-element list in the format + * { "content type", "root directory", "shared storage", "url stub" }. + * + * Content type is the object type of the content type. + * Root directory must be a path to a writable directory, relative to the + * webapp root. + * Shared storage must be true if the root directory is shared NFS storage, + * false otherwise. + * URL stub is the path component of the URL from which the live + * server will serve from this directory. + * + * By default the object type of the last element is template. P2FS is not + * only used to store content items in the file system but to watch templates + * stored in the database (by parameter or Web GUI) and synchronize them + * with the file system so that the servlet container is able to use them. + */ + public List getPublishDestinations() { + // Comment by pboy (Febr. 2010) + // In the old Initializer system this parameter was burried in the + // enterprise.init file which used to be part of the jar file. Therefore, + // it was practically not configurable by users, just by developers only + // (who can recompile and create a jar file). + // P2fs for content items is rarely used, or even not at all. Location of + // templates is fixed for any installation. So we return a constant List + // here. Developers may modify it as needed. + // If someone needs p2fs for content items we have to create a List type + // parameter and make it configurable. + + // Quick 'n dirty but works + s_tmpDestList = new ArrayList(); + s_tmpDestList.add + ( new ArrayList() {{ add("com.arsdigita.cms.ContentItem"); + add("p2fs"); + add(new Boolean(false)); + add("/p2fs"); + }} + ); + s_tmpDestList.add + ( new ArrayList() {{ + add("com.arsdigita.cms.Template"); + add("packages/content-section/templates"); + add(new Boolean(false)); + add("/templates"); + }} + ); + + s_log.debug("s_tmpDestList is " + s_tmpDestList.size() ); + return s_tmpDestList; + } + /** * Retrieve the class which implements PublishToFileListener used to perform * additional actions when publishing or unpublishing to the file system. * * @return PublishToFileListener implementation class */ - public Class getpublishListenerClass() { - return (Class) get(m_publishListener); + public Class getPublishListenerClass() { + return (Class) get(m_publishToFileListenerClass); } /** @@ -306,8 +368,19 @@ public class PublishToFileConfig extends AbstractConfig { } /** - * Retrieve simple queue's period in seconds - * @return period, in seconds + * Retrieve time to wait (seconds) before aborting an item request. + * + * @return timeout, in seconds. + */ + public int getRequestTimeout() { + s_log.debug("Retrieving m_requestTimeout."); + return ((Integer) get(m_requestTimeout)).intValue(); + } + + /** + * Retrieve number of queue entries to process at once. + * + * @return number of blocks. */ public int getBlockSize() { s_log.debug("Retrieving m_blockSize."); @@ -315,21 +388,25 @@ public class PublishToFileConfig extends AbstractConfig { } /** - * Retrieve digest queue's delay in seconds. - * @return delay, in seconds. - */ - public int getMaximumFailCount() { - s_log.debug("Retrieving m_maximumFailCount."); - return ((Integer) get(m_maximumFailCount)).intValue(); - } - - /** - * Retrieve digest queue's period in seconds - * @return period, in seconds + * Retrieve method used to select entries for processing. + * + * @return 'QueuedOrder' or 'GroupByParent' (default) */ public String getBlockSelectMethod() { s_log.debug("Retrieving m_blockSelectMethod."); return ( (String) get(m_blockSelectMethod)); } + /** + * Retrieve number of times a failed queue entry will be reprocessed. If + * Fail Count in database is more than specified limit, Queue Manager + * will ignore the action. + * + * @return number of times + */ + public int getMaximumFailCount() { + s_log.debug("Retrieving m_maximumFailCount."); + return ((Integer) get(m_maximumFailCount)).intValue(); + } + } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig_parameter.properties index b47dc7337..9d0b5e408 100644 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig_parameter.properties +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig_parameter.properties @@ -1,3 +1,15 @@ +com.arsdigita.cms.disable_item_pfs.title=Disable (non-Template) Item p2fs +com.arsdigita.cms.disable_item_pfs.purpose=Disable publish-to-filesystem for items other than templates. +com.arsdigita.cms.disable_item_pfs.example=true +com.arsdigita.cms.disable_item_pfs.format=[boolean] + + +com.arsdigita.cms.publish_to_file_class.title=Publish to File listener class +com.arsdigita.cms.publish_to_file_class.purpose=Class implementing PublishToFileListener. Contains the initial methods called when publishing or unpublishing. Normally this should be set to com.arsdigita.cms.publishToFile.PublishToFile, but custom classes can also be used. +com.arsdigita.cms.publish_to_file_class.example=com.arsdigita.cms.publishToFile.PublishToFile +com.arsdigita.cms.publish_to_file_class.format=[class] + + waf.notification.request_manager_delay.title=Request Manager Delay waf.notification.request_manager_delay.purpose=Start of request manager's delay in seconds. waf.notification.request_manager_delay.example=900 diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/enterprise.init b/ccm-cms/src/com/arsdigita/cms/publishToFile/enterprise.init.nolongerInUse similarity index 100% rename from ccm-cms/src/com/arsdigita/cms/publishToFile/enterprise.init rename to ccm-cms/src/com/arsdigita/cms/publishToFile/enterprise.init.nolongerInUse