From 19da24d433a4e50a4881684fc645132949b9a2ab Mon Sep 17 00:00:00 2001 From: pb Date: Fri, 3 Feb 2012 17:27:05 +0000 Subject: [PATCH] Beseitigen Fehler mit Initialisierung PublishToFile, diverse Formatierungen. git-svn-id: https://svn.libreccm.org/ccm/trunk@1486 8810af33-2d31-482b-a856-94f89814c4df --- .../src/com/arsdigita/cms/ContentItem.java | 4 +- .../arsdigita/cms/ContentSectionServlet.java | 48 +++++++---- ccm-cms/src/com/arsdigita/cms/Loader.java | 67 ++++++++++----- .../com/arsdigita/cms/TemplateCollection.java | 8 +- .../com/arsdigita/cms/TemplateManager.java | 2 +- .../publishToFile/PublishToFileConfig.java | 2 +- .../dispatcher/DispatcherHelper.java | 7 +- .../dispatcher/JSPApplicationDispatcher.java | 2 +- .../kernel/PackageEventListener.java | 10 +++ .../com/arsdigita/kernel/PackageInstance.java | 28 ++++++- .../src/com/arsdigita/kernel/PackageType.java | 1 - .../kernel/PackageTypeCollection.java | 29 ++++++- .../src/com/arsdigita/kernel/SiteNode.java | 84 +++++++++++++++++++ .../sitenode/SiteNodeRequestContext.java | 12 ++- .../templating/PresentationManager.java | 10 +-- .../arsdigita/web/ApplicationFileServlet.java | 20 +++-- .../com/arsdigita/web/ApplicationSetup.java | 8 ++ .../com/arsdigita/web/ApplicationType.java | 27 +++++- ccm-core/src/com/arsdigita/web/Web.java | 9 +- .../src/com/arsdigita/web/WebContext.java | 26 ++++++ 20 files changed, 335 insertions(+), 69 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItem.java b/ccm-cms/src/com/arsdigita/cms/ContentItem.java index d6e764206..561c86580 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentItem.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentItem.java @@ -616,9 +616,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { * The item's root is the ancestor reachable through repeated * getParent() calls whose parent is * null. This is usually a folder, but may be any - * { - * - * @see com.arsdigita.kernel.ACSObject}. + * {@see com.arsdigita.kernel.ACSObject}. * * Note that the name of the root folder of the content section where the * item resides is not included in the path. diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java b/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java index 56382de7f..6aeff78c7 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSectionServlet.java @@ -47,8 +47,6 @@ import com.arsdigita.web.BaseApplicationServlet; import com.arsdigita.web.LoginSignal; import com.arsdigita.web.Web; -import org.apache.log4j.Logger; - import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; @@ -61,7 +59,10 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.log4j.Logger; + /** + * Content Section's application servlet * * Repaired ItemURLCache to save multilingual items with automatic * language negotiation. The cahce now uses the remaining url part @@ -74,23 +75,23 @@ import javax.servlet.http.HttpServletResponse; public class ContentSectionServlet extends BaseApplicationServlet { + private static final Logger s_log = + Logger.getLogger(ContentSectionServlet.class); + + /** Stringarray of file name patterns for index files. Should be made + configurable. */ private static final String[] WELCOME_FILES = new String[] { "index.jsp", "index.html" }; - private static final Logger s_log = - Logger.getLogger(ContentSectionServlet.class); - private ContentItemDispatcher m_disp = new ContentItemDispatcher(); - public static Map s_itemResolverCache = - Collections.synchronizedMap(new HashMap()); + public static Map s_itemResolverCache = Collections + .synchronizedMap(new HashMap()); - //cache the content items + /** cache the content items */ private static Map s_itemURLCacheMap = null; - /** - * The context for previewing items - */ + /** The context for previewing items */ public static final String PREVIEW = "/preview"; public static final String FILE_SUFFIX = ".jsp"; public static final String INDEX_FILE = "/index"; @@ -107,17 +108,20 @@ public class ContentSectionServlet extends BaseApplicationServlet { private static final String CACHE_KEY_DELIMITER = "%"; /** + * Implements the service method of BaseApplicationServlet * @see com.arsdigita.web.BaseApplicationServlet#doService * (HttpServletRequest, HttpServletResponse, Application) */ - protected void doService - (HttpServletRequest sreq, HttpServletResponse sresp, Application app) - throws ServletException, IOException { + protected void doService( HttpServletRequest sreq, + HttpServletResponse sresp, + Application app) + throws ServletException, IOException { ContentSection section = (ContentSection) app; RequestContext ctx = DispatcherHelper.getRequestContext(); - String url = ctx.getRemainingURLPart(); + + String url = ctx.getRemainingURLPart(); // here SiteNodeRequestContext if (s_log.isInfoEnabled()) { s_log.info("Resolving item URL " + url); @@ -129,6 +133,8 @@ public class ContentSectionServlet extends BaseApplicationServlet { final ContentItem item = getItem(section, url, itemResolver); if (item != null) { + + /* We have to serve an item here */ String param = sreq.getParameter("transID"); if (param != null) { @@ -148,7 +154,10 @@ public class ContentSectionServlet extends BaseApplicationServlet { } serveItem(sreq, sresp, section, item); + } else { + + /* We have to deal with a content-section, folder or an other bit*/ if (s_log.isInfoEnabled()) { s_log.info("NOT serving content item"); } @@ -196,6 +205,15 @@ public class ContentSectionServlet extends BaseApplicationServlet { } } + /** + * + * @param sreq + * @param sresp + * @param section + * @param item + * @throws ServletException + * @throws IOException + */ private void serveItem(HttpServletRequest sreq, HttpServletResponse sresp, ContentSection section, diff --git a/ccm-cms/src/com/arsdigita/cms/Loader.java b/ccm-cms/src/com/arsdigita/cms/Loader.java index c878c35fc..4f3f21638 100755 --- a/ccm-cms/src/com/arsdigita/cms/Loader.java +++ b/ccm-cms/src/com/arsdigita/cms/Loader.java @@ -59,7 +59,9 @@ import org.apache.log4j.Logger; // // Next Try // Refactor using legacy compatible web/Application and ApplicationSetup DONE - +// Refactor content-section als legacy free application +// Refactor workspace (content-center) as a legacy free application +// Refactor cms-service as a legacy free application /** *

Executes nonrecurring at install time and loads (installs and initializes) @@ -93,10 +95,10 @@ public class Loader extends PackageLoader { private static final Logger s_log = Logger.getLogger(Loader.class); /** Loader configuration object, singleton design pattern - * NOTE: LoaderConfig only supplies unmutable hatrd coded defaults! It is - * not possible to alter any to the contained values by specifiying an + * NOTE: LoaderConfig only supplies unmutable hard coded defaults! It is + * not possible to alter any of the contained values by specifiying an * configuration parameter during load step. If a configuration value - * has to be configurable at load time, the parameter must be relcated + * has to be configurable at load time, the parameter must be relocated * into this Loader class! */ private static final LoaderConfig s_conf = LoaderConfig.getInstance(); @@ -116,13 +118,12 @@ public class Loader extends PackageLoader { new String[] {"content"} ); - - /** List of classnames of internal base content types (needed in every * section created), generated while loading those content types in * loadContentTypeDefinitions(files) for later use in register step. */ private ArrayList m_content_type_list = new ArrayList(); + /** * Standard constructor. */ @@ -192,7 +193,7 @@ public class Loader extends PackageLoader { } /** - * Loads and instantiates the Workspace package (content-center) in the + * Loads and instantiates the Workspace subpackage (content-center) in the * database. * It is made public to be able to invoke it from the update script * (e.g. 6.6.1-6.6.2). @@ -323,7 +324,7 @@ public class Loader extends PackageLoader { * NOTE: At ccm-cms load time no content type packages are available because * any content type depends on ccm-cms. Therefore, the loading step can not * process content type package assignment! Instead each content type itself - * must assign itself to an apropriate content section at it's load time. + * must assign itself to an appropriate content section at it's load time. * Cf. {@link com.arsdigita.cms.contenttype.AbstractContentTypeLoader}. * * But the load step has to process the cms internal content types! @@ -332,27 +333,49 @@ public class Loader extends PackageLoader { // Step 1: Create content section application type // prerequisite for concrete content-section instance creation. - ApplicationSetup appType = new ApplicationSetup(s_log); - appType.setApplicationObjectType(ContentSection.BASE_DATA_OBJECT_TYPE); - appType.setKey(ContentSection.PACKAGE_TYPE); // by default: content-section - appType.setTitle("CMS Content Section"); - appType.setDescription("A CMS Content Section"); - appType.setPortalApplication(false); + +// ////////////// Deprecated style to create app type /////////////// +// ////////////// Delete when migration process completed /////////////// +// ApplicationSetup appType = new ApplicationSetup(s_log); +// appType.setApplicationObjectType(ContentSection.BASE_DATA_OBJECT_TYPE); +// appType.setKey(ContentSection.PACKAGE_TYPE); // by default: content-section +// appType.setTitle("CMS Content Section"); +// appType.setDescription("A CMS Content Section"); +// appType.setPortalApplication(false); //setup.setDispatcherClass(ContentItemDispatcher.class.getName()); // contains the xsl to generate the page // ApplicationSetup requires an Instantiator which has to be set here // Setting it up in Initializer prior to creating the application type // doesn't work! - appType.setInstantiator(new ACSObjectInstantiator() { - @Override - public DomainObject doNewInstance(DataObject dataObject) { - return new ContentSection(dataObject); - } - }); - - appType.run(); +// appType.setInstantiator(new ACSObjectInstantiator() { +// @Override +// public DomainObject doNewInstance(DataObject dataObject) { +// return new ContentSection(dataObject); +// } +// }); +// appType.run(); +// //////////////////////////////////////////////////////////////////////// + /* Create new stype legacy compatible application type * / + ApplicationType type = ApplicationType + .createApplicationType(ContentSection.PACKAGE_TYPE, + "CMS Content Section", + ContentSection.BASE_DATA_OBJECT_TYPE); +*/ + /* Create legacy-free application type + * NOTE: The wording in the title parameter of ApplicationType + * determines the name of the subdirectory for the XSL stylesheets. + * It gets "urlized", i.e. trimming leading and trailing blanks and + * replacing blanks between words and illegal characters with an + * hyphen and converted to lower case. + * "Content Section" will become "content-section". */ + ApplicationType type = new ApplicationType( + "Content Section", + ContentSection.BASE_DATA_OBJECT_TYPE ); + type.setDescription("A CMS Content Section."); + type.save(); + // Step 2: Load CMS specific privileges into central (core) privilege // system. createPrivileges(); diff --git a/ccm-cms/src/com/arsdigita/cms/TemplateCollection.java b/ccm-cms/src/com/arsdigita/cms/TemplateCollection.java index d8faef54b..9aef4feb0 100755 --- a/ccm-cms/src/com/arsdigita/cms/TemplateCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/TemplateCollection.java @@ -29,12 +29,12 @@ import com.arsdigita.mimetypes.MimeType; * Represents a collection of template mappings along with their * link attributes. * - * @author Stanislav Freidin (sfreidin@arsdigita.com) - * @version $Id: TemplateCollection.java 2090 2010-04-17 08:04:14Z pboy $ - * * @see com.arsdigita.domain.DomainCollection * @see com.arsdigita.persistence.DataCollection * @see com.arsdigita.cms.ItemTemplateCollection + * + * @author Stanislav Freidin (sfreidin@arsdigita.com) + * @version $Id: TemplateCollection.java 2090 2010-04-17 08:04:14Z pboy $ */ public abstract class TemplateCollection extends DomainCollection { @@ -55,6 +55,7 @@ public abstract class TemplateCollection extends DomainCollection { * before next() is called on this collection. * */ + @Override public void addOrder(String order) { m_dataCollection.addOrder(order); } @@ -90,6 +91,7 @@ public abstract class TemplateCollection extends DomainCollection { /** * Filter this collection for equality by the specified attribute */ + @Override public Filter addEqualsFilter(String attr, Object value) throws PersistenceException { return m_dataCollection.addEqualsFilter(attr, value); diff --git a/ccm-cms/src/com/arsdigita/cms/TemplateManager.java b/ccm-cms/src/com/arsdigita/cms/TemplateManager.java index c8050a3c7..59053a0e4 100755 --- a/ccm-cms/src/com/arsdigita/cms/TemplateManager.java +++ b/ccm-cms/src/com/arsdigita/cms/TemplateManager.java @@ -61,7 +61,7 @@ import com.arsdigita.mimetypes.MimeType; * @author Stanislav Freidin (sfreidin@arsdigita.com) * @version $Revision: #9 $ $DateTime: 2004/08/17 23:15:09 $ * @version $Id: TemplateManager.java 2090 2010-04-17 08:04:14Z pboy $ - **/ + */ public interface TemplateManager { /** diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java index 281258f9d..1e05b91f1 100644 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFileConfig.java @@ -97,7 +97,7 @@ public class PublishToFileConfig extends AbstractConfig { " false, " + " '/p2fs' }, " + " { 'com.arsdigita.cms.Template', " + - CMS.getConfig().getTemplateRoot() + + " '/templates/ccm-cms/content-section', " + " false, " + " '/templates' } " + "} " diff --git a/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java b/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java index 6cb3288be..782bac8fd 100755 --- a/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java +++ b/ccm-core/src/com/arsdigita/dispatcher/DispatcherHelper.java @@ -55,12 +55,13 @@ import org.apache.log4j.Logger; * Contains various generally useful procedural abstractions. * * @author Bill Schneider - * @version ACS 4.5 + * @since 4.5 * @version $Id: DispatcherHelper.java 311 2005-02-28 11:10:00Z mbooth $ - * @since 4.5 */ + */ public final class DispatcherHelper implements DispatcherConstants { private static final Logger s_log = Logger.getLogger(DispatcherHelper.class); + private static String s_webappCtx; private static String s_staticURL; private static boolean s_cachingActive; @@ -85,6 +86,7 @@ public final class DispatcherHelper implements DispatcherConstants { initialized = true; } + /** * The current HttpServletRequest. */ @@ -841,6 +843,7 @@ public final class DispatcherHelper implements DispatcherConstants { * Gets the current HttpServletRequest for this thread. * @return the current HttpServletRequest for this thread. */ + public static HttpServletRequest getRequest() { init(); return (HttpServletRequest) s_request.get(); diff --git a/ccm-core/src/com/arsdigita/dispatcher/JSPApplicationDispatcher.java b/ccm-core/src/com/arsdigita/dispatcher/JSPApplicationDispatcher.java index 94c8dfdd9..dc417d0fc 100755 --- a/ccm-core/src/com/arsdigita/dispatcher/JSPApplicationDispatcher.java +++ b/ccm-core/src/com/arsdigita/dispatcher/JSPApplicationDispatcher.java @@ -62,7 +62,7 @@ import org.apache.log4j.Logger; * @version $Id: JSPApplicationDispatcher.java 287 2005-02-22 00:29:02Z sskracic $ */ public class JSPApplicationDispatcher extends BaseDispatcherServlet - implements Dispatcher { + implements Dispatcher { private static final Logger s_log = Logger.getLogger (JSPApplicationDispatcher.class); diff --git a/ccm-core/src/com/arsdigita/kernel/PackageEventListener.java b/ccm-core/src/com/arsdigita/kernel/PackageEventListener.java index 597bb1d53..870a876f5 100755 --- a/ccm-core/src/com/arsdigita/kernel/PackageEventListener.java +++ b/ccm-core/src/com/arsdigita/kernel/PackageEventListener.java @@ -33,6 +33,8 @@ package com.arsdigita.kernel; * @since ACS 5.0 * @version $Revision: #7 $, $Date: 2004/08/16 $ * @version $Id: PackageEventListener.java 287 2005-02-22 00:29:02Z sskracic $ + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public interface PackageEventListener { @@ -42,6 +44,8 @@ public interface PackageEventListener { * * @param siteNode the SiteNode where the instance is mounted * @param pkg the instance being mounted + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public void onMount(SiteNode siteNode, PackageInstance pkg); @@ -51,6 +55,8 @@ public interface PackageEventListener { * * @param siteNode the SiteNode where the instance is mounted * @param pkg the instance being unmounted + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public void onUnmount(SiteNode siteNode, PackageInstance pkg); @@ -59,6 +65,8 @@ public interface PackageEventListener { * Called when a new package instance is created. * * @param pkg a PackageInstance value + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public void onCreate(PackageInstance pkg); @@ -66,6 +74,8 @@ public interface PackageEventListener { * Describe onDelete method here. * * @param pkg a PackageInstance value + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public void onDelete(PackageInstance pkg); diff --git a/ccm-core/src/com/arsdigita/kernel/PackageInstance.java b/ccm-core/src/com/arsdigita/kernel/PackageInstance.java index 6d3ceb75b..831c66438 100755 --- a/ccm-core/src/com/arsdigita/kernel/PackageInstance.java +++ b/ccm-core/src/com/arsdigita/kernel/PackageInstance.java @@ -43,6 +43,8 @@ import org.apache.log4j.Logger; * @see PackageType * @version $Revision: #14 $, $Date: 2004/08/16 $ * @version $Id: PackageInstance.java 287 2005-02-22 00:29:02Z sskracic $ + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public class PackageInstance extends ACSObject { @@ -87,7 +89,9 @@ public class PackageInstance extends ACSObject { * @see com.arsdigita.domain.DomainObject#DomainObject(String) * @see PackageType#createInstance * @see #PackageInstance(OID) - **/ + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ protected PackageInstance() { super(BASE_DATA_OBJECT_TYPE); } @@ -97,6 +101,8 @@ public class PackageInstance extends ACSObject { * data object. * * @param dataObject a PackageInstance data object + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public PackageInstance(DataObject dataObject) { super(dataObject); @@ -108,6 +114,8 @@ public class PackageInstance extends ACSObject { * @param id the primary key of the package instance * @exception DataObjectNotFoundException if the id does not * correspond to an existing package instance. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public PackageInstance(BigDecimal id) throws DataObjectNotFoundException { super(new OID(BASE_DATA_OBJECT_TYPE, id)); @@ -119,6 +127,8 @@ public class PackageInstance extends ACSObject { * @param oid the objectID of the package instance * @exception DataObjectNotFoundException If the OID does not * correspond to an existing package instance. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public PackageInstance(OID oid) throws DataObjectNotFoundException { super(oid); @@ -135,6 +145,10 @@ public class PackageInstance extends ACSObject { return m_packageType; } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ protected void setType(PackageType type) { setAssociation("packageType", type); m_packageType = type; @@ -149,6 +163,9 @@ public class PackageInstance extends ACSObject { * if this package instance is not mounted. * @return the first site node on which this package instance is mounted, * or null if this package instance is not mounted. + * + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. **/ public SiteNode getDefaultMountPoint() { SiteNode defaultMountPoint = null; @@ -180,6 +197,8 @@ public class PackageInstance extends ACSObject { /** * Gets the name of this package. * @return the package key. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public String getKey() { return getType().getKey(); @@ -188,6 +207,8 @@ public class PackageInstance extends ACSObject { /** * Sets the package key. * @param key the key for this package + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public void setKey(String key) { set("packageKey", key); @@ -196,6 +217,8 @@ public class PackageInstance extends ACSObject { /** * Gets the package name. * @return the package's name. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public String getName() { return (String)get("prettyName"); @@ -205,7 +228,10 @@ public class PackageInstance extends ACSObject { * Returns a display name for this package instance. * * @see ACSObject#getDisplayName() + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ + @Override public String getDisplayName() { return getName(); } diff --git a/ccm-core/src/com/arsdigita/kernel/PackageType.java b/ccm-core/src/com/arsdigita/kernel/PackageType.java index 76d8df6b6..f02d11227 100755 --- a/ccm-core/src/com/arsdigita/kernel/PackageType.java +++ b/ccm-core/src/com/arsdigita/kernel/PackageType.java @@ -45,7 +45,6 @@ import org.apache.log4j.Logger; * @since ACS 5.0 * @version $Revision: #15 $, $Date: 2004/08/16 $ * @version $Id: PackageType.java 287 2005-02-22 00:29:02Z sskracic $ - * @deprecated without direct replacement. Refactor to use * {@link com.arsdigita.web.ApplicationType} instead. */ diff --git a/ccm-core/src/com/arsdigita/kernel/PackageTypeCollection.java b/ccm-core/src/com/arsdigita/kernel/PackageTypeCollection.java index 41f6b2e1c..adbcf3577 100755 --- a/ccm-core/src/com/arsdigita/kernel/PackageTypeCollection.java +++ b/ccm-core/src/com/arsdigita/kernel/PackageTypeCollection.java @@ -23,19 +23,46 @@ import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; +/** + * Represents a collection of package types. + * + * @since ACS 5.0 + * @version $Revision: #15 $, $Date: 2004/08/16 $ + * @version $Id: PackageTypeCollection.java 287 2005-02-22 00:29:02Z sskracic $ + + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.ApplicationTypeCollection} instead. + */ public class PackageTypeCollection extends DomainCollection { - public static final String versionId = "$Id: PackageTypeCollection.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; + /** + * + * @param dataCollection + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.ApplicationTypeCollection} instead. + */ protected PackageTypeCollection(DataCollection dataCollection) { super(dataCollection); } + /** + * + * @return + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.ApplicationTypeCollection} instead. + */ public DomainObject getDomainObject() { DomainObject domainObject = getPackageType(); return domainObject; } + /** + * + * @return + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.ApplicationTypeCollection} instead. + */ public PackageType getPackageType() { DataObject dataObject = m_dataCollection.getDataObject(); diff --git a/ccm-core/src/com/arsdigita/kernel/SiteNode.java b/ccm-core/src/com/arsdigita/kernel/SiteNode.java index 96a7a2f97..63e1fa3cc 100755 --- a/ccm-core/src/com/arsdigita/kernel/SiteNode.java +++ b/ccm-core/src/com/arsdigita/kernel/SiteNode.java @@ -62,6 +62,7 @@ import org.apache.log4j.Logger; * @version $Id: SiteNode.java 287 2005-02-22 00:29:02Z sskracic $ * @since ACS 5.0 * @deprecated Refactor to use {@link com.arsdigita.web.Application} instead. + * The class is due to completly be removed. */ public class SiteNode extends ACSObject { @@ -148,11 +149,22 @@ public class SiteNode extends ACSObject { * * @param req Servlet request. This is needed to get the context * path, in case the servlet is not mounted at /. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public String getURL(HttpServletRequest req) { return getURL(req==null ? (String) null : req.getContextPath()); } + + /** + * Gets the URL of the site note. + * + * @param req Servlet request. This is needed to get the context + * path, in case the servlet is not mounted at /. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public String getUrl(HttpServletRequest req) { return getURL(req); } @@ -162,6 +174,8 @@ public class SiteNode extends ACSObject { * user! * * @param ContextPath in case the servlet is not mounted at / + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public String getURL(String contextPath) { if (contextPath != null) { @@ -171,19 +185,35 @@ public class SiteNode extends ACSObject { } } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public String getUrl(String contextPath) { return getURL(contextPath); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public String getURL() { return getURLNoContext(); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ private void setURL() { s_log.debug("Setting url: " + getURLFromParent()); set("url", getURLFromParent()); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ private String getURLFromParent() { SiteNode parent = getParent(); if (parent != null) { @@ -196,6 +226,8 @@ public class SiteNode extends ACSObject { /** * @return the URL of the site node, not the URL * requested by the user! + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public String getURLNoContext() { String value = (String)get("url"); @@ -206,15 +238,27 @@ public class SiteNode extends ACSObject { } } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public BigDecimal getNodeId() { return (BigDecimal) get("id"); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public void setName(String name) { set("name", name); setURL(); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public void setParent(SiteNode siteNode) { // Should throw an Exception if parent is not a directory. @@ -229,6 +273,10 @@ public class SiteNode extends ACSObject { setURL(); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public String getName() { String name = (String) get("name"); @@ -243,6 +291,8 @@ public class SiteNode extends ACSObject { * Returns a display name for this site node. * * @see ACSObject#getDisplayName() + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ @Override public String getDisplayName() { @@ -252,6 +302,8 @@ public class SiteNode extends ACSObject { /** * @return true if this SiteNode can have children; * false otherwise. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public boolean isDirectory() { return ((Boolean) (get("isDirectory"))).booleanValue(); @@ -266,6 +318,10 @@ public class SiteNode extends ACSObject { return ((Boolean)(get("isPattern"))).booleanValue(); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public PackageInstance getPackageInstance() { DataObject dataObject = (DataObject)get("mountedObject"); if (dataObject != null) { @@ -278,6 +334,10 @@ public class SiteNode extends ACSObject { } } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public void mountPackage(PackageInstance pkg) { unMountPackage(); @@ -291,6 +351,10 @@ public class SiteNode extends ACSObject { } } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public void unMountPackage() { PackageInstance pkg = getPackageInstance(); @@ -306,6 +370,10 @@ public class SiteNode extends ACSObject { } } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public SiteNode getParent() { DataObject dataObject = (DataObject)get("parent"); @@ -316,11 +384,19 @@ public class SiteNode extends ACSObject { } } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public SiteNodeCollection getChildren() { DataAssociation childAssociation = (DataAssociation) get("children"); return new SiteNodeCollection(childAssociation); } + /** + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. + */ public static SiteNode getRootSiteNode() { // cache the site node statically // note lack of synchronization. worst case: @@ -363,6 +439,8 @@ public class SiteNode extends ACSObject { * cached site nodes. Call this method AFTER creating * any new site nodes as part of your unit test's * setup method + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public static void repopulateCache() { s_cache.refresh(); @@ -385,6 +463,8 @@ public class SiteNode extends ACSObject { * with a slash (probably the wrong behavior) or if the * RootSiteNode was requested but couldn't be found (also * probably wrong). + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public static SiteNode getSiteNode(final String path, boolean readOnly) throws DataObjectNotFoundException { @@ -415,6 +495,8 @@ public class SiteNode extends ACSObject { * with a slash (probably the wrong behavior) or if the * RootSiteNode was requested but couldn't be found (also * probably wrong). + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ public static SiteNode getSiteNode(String path) throws DataObjectNotFoundException { @@ -429,6 +511,8 @@ public class SiteNode extends ACSObject { * Overrides the default save method. If we've changed the * URL of this site node (either by changing its name or its parent), * we need to also update the URL for all descendants of this site node. + * @deprecated without direct replacement. Refactor to use + * {@link com.arsdigita.web.Application} instead. */ protected void beforeSave() { if (isPropertyModified("url") || isNew()) { diff --git a/ccm-core/src/com/arsdigita/sitenode/SiteNodeRequestContext.java b/ccm-core/src/com/arsdigita/sitenode/SiteNodeRequestContext.java index a99b6685d..0d8894f1a 100755 --- a/ccm-core/src/com/arsdigita/sitenode/SiteNodeRequestContext.java +++ b/ccm-core/src/com/arsdigita/sitenode/SiteNodeRequestContext.java @@ -54,7 +54,8 @@ public class SiteNodeRequestContext extends KernelRequestContext { /** * Copy constructor. - **/ + * @deprecated + */ protected SiteNodeRequestContext(SiteNodeRequestContext that) { super(that); this.m_sn = that.m_sn; @@ -65,7 +66,8 @@ public class SiteNodeRequestContext extends KernelRequestContext { * Build a new application context given an original app context, * and a destination site node. Part of the previously-remaining URL * is consumed by the site node's URL, and part remains. - **/ + * @deprecated + */ public SiteNodeRequestContext(HttpServletRequest req, RequestContext parent, SiteNode sn, @@ -178,6 +180,7 @@ public class SiteNodeRequestContext extends KernelRequestContext { * JSP-based resources will be found. * Returns with a trailing slash, e.g., * "/packages/package-key/www/" + * @deprecated */ public String getPageBase() { return "/packages/" @@ -185,6 +188,11 @@ public class SiteNodeRequestContext extends KernelRequestContext { "/www/"; } + /** + * + * @return + * @deprecated + */ public PackageInstance getPackageInstance() { return getSiteNode().getPackageInstance(); } diff --git a/ccm-core/src/com/arsdigita/templating/PresentationManager.java b/ccm-core/src/com/arsdigita/templating/PresentationManager.java index f050bd219..0d0b45872 100755 --- a/ccm-core/src/com/arsdigita/templating/PresentationManager.java +++ b/ccm-core/src/com/arsdigita/templating/PresentationManager.java @@ -32,17 +32,15 @@ import javax.servlet.http.HttpServletResponse; * dynamically apply a set of templates to an XML document in a custom * way. Typically, this occurs if the template selection * depends on the outcome of some application-specific logic. + * + * @see com.arsdigita.sitenode.SiteNodePresentationManager + * @see com.arsdigita.sitenode.BasePresentationManager * * @author Bill Schneider * @version ACS 4.6 - * @see com.arsdigita.sitenode.SiteNodePresentationManager - * @see com.arsdigita.sitenode.BasePresentationManager + * @version $Id: PresentationManager.java 738 2005-09-01 12:36:52Z sskracic $ */ public interface PresentationManager { - public static final String versionId = - "$Id: PresentationManager.java 738 2005-09-01 12:36:52Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; /** * Serves a page whose content is defined by the input XML diff --git a/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java b/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java index 28a30bdb5..3f6bda791 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationFileServlet.java @@ -35,8 +35,7 @@ import org.apache.log4j.Logger; /** *

- * A simple servlet for dispatching abstract URLs - * to concrete JSP files. + * A simple servlet for dispatching abstract URLs to concrete JSP files. *

*

* This is intended to be used in all places where BebopMapServlet would @@ -64,6 +63,7 @@ import org.apache.log4j.Logger; * </servlet-mapping> * </web-app> * + * *

* In the Application class it should define: *

@@ -88,7 +88,7 @@ import org.apache.log4j.Logger; * gets resolved to *

*
- * /templaates/myparentapp/myappinstance/foo.jsp
+ * /templates/myparentapp/myappinstance/foo.jsp
  * /templates/myparentapp/foo.jsp
  * /templates/foo.jsp
  * 
@@ -111,7 +111,8 @@ public class ApplicationFileServlet extends BaseApplicationServlet { */ @Override public void init(ServletConfig config) - throws ServletException { + throws ServletException { + super.init(config); // init-param named template-path from ~/WEB-INF/web.xml @@ -123,6 +124,7 @@ public class ApplicationFileServlet extends BaseApplicationServlet { "template-path must not end with '/'"); + // optional init-param named file-resolver from ~/WEB-INF/web.xml String resolverName = config.getInitParameter("file-resolver"); if (resolverName == null) { m_resolver = Web.getConfig().getApplicationFileResolver(); @@ -135,10 +137,18 @@ public class ApplicationFileServlet extends BaseApplicationServlet { } } + /** + * + * @param sreq + * @param sresp + * @param app + * @throws ServletException + * @throws IOException + */ protected void doService(HttpServletRequest sreq, HttpServletResponse sresp, Application app) - throws ServletException, IOException { + throws ServletException, IOException { RequestDispatcher rd = m_resolver.resolve(m_templatePath, sreq, sresp, app); diff --git a/ccm-core/src/com/arsdigita/web/ApplicationSetup.java b/ccm-core/src/com/arsdigita/web/ApplicationSetup.java index c5f0fce78..6eada1b71 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationSetup.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationSetup.java @@ -58,6 +58,14 @@ import org.apache.log4j.Category; * @see com.arsdigita.web.ApplicationType * @author Justin Ross <jross@redhat.com> * @version $Id: ApplicationSetup.java 287 2005-02-22 00:29:02Z sskracic $ + * @deprecated without direct replacement. + * Class requires ApplicationSetup.setInstantiator( ...) domain initialization + * code which is only useful in old legacy initialization code. Initialization + * now differentiates bitween one time loading step and recurring initialization + * step. + * Use ApplicationType apptype = new ApplicationType(...) and + * Application app Application.createApplication(...) instead to create + * new style legacy free applications. */ public class ApplicationSetup { diff --git a/ccm-core/src/com/arsdigita/web/ApplicationType.java b/ccm-core/src/com/arsdigita/web/ApplicationType.java index bc96f30d1..950701615 100755 --- a/ccm-core/src/com/arsdigita/web/ApplicationType.java +++ b/ccm-core/src/com/arsdigita/web/ApplicationType.java @@ -179,6 +179,7 @@ public class ApplicationType extends ResourceType { * Creates a legacy-compatible application type. Types created * via this constructor use the passed in package type to back the * new application type. + * @deprecated without direct replacement. Refactor to legacy free app. */ protected ApplicationType(final String dataObjectType, final PackageType packageType, @@ -196,6 +197,7 @@ public class ApplicationType extends ResourceType { * @param title * @param applicationObjectType * @param createContainerGroup + * @deprecated without direct replacement. Refactor to legacy free app. */ protected ApplicationType(final String dataObjectType, final PackageType packageType, @@ -223,6 +225,7 @@ public class ApplicationType extends ResourceType { /** * Creates a legacy-compatible application type using the passed * in package type using an internal constructor (below). + * @deprecated without direct replacement. Refactor to legacy free app. */ public static ApplicationType createApplicationType(PackageType packageType, String title, @@ -236,6 +239,7 @@ public class ApplicationType extends ResourceType { * parameter is used to create a legacy package type to back the * new application type. * This variant is applicatable if packageType does not already exist! + * @deprecated without direct replacement. Refactor to legacy free app. */ protected ApplicationType(String dataObjectType, String key, String title, String applicationObjectType) { @@ -251,8 +255,9 @@ public class ApplicationType extends ResourceType { * @param key of the package to be created * @param title of the package to be created * @return + * @deprecated without direct replacement. Refactor to legacy free app. */ - private static final PackageType makePackageType(String key, String title) { + private static PackageType makePackageType(String key, String title) { PackageType packageType = new PackageType(); Assert.exists(key, "key"); @@ -269,6 +274,7 @@ public class ApplicationType extends ResourceType { * Creates a legacy-compatible application type. The key * parameter is used to create a legacy package type to back the * new application type. + * @deprecated without direct replacement. Refactor to legacy free app. */ public static ApplicationType createApplicationType(String key, String title, String applicationObjectType) { @@ -282,6 +288,7 @@ public class ApplicationType extends ResourceType { * Creates a legacy-compatible application type. The key * parameter is used to create a legacy package type to back the * new application type. + * @deprecated without direct replacement. Refactor to legacy free app. */ public static ApplicationType createApplicationType( String key, String title, @@ -368,7 +375,11 @@ public class ApplicationType extends ResourceType { // Association properties (some by proxy) // - // Can return null. + /** + * Can return null. + * @return + * @deprecated without direct replacement. Refactor to legacy free app. + */ public PackageType getPackageType() { if (m_legacyFree == true) { throw new UnsupportedOperationException @@ -423,6 +434,7 @@ public class ApplicationType extends ResourceType { // Member properties // + @Override public String getTitle() { String title = (String) get("title"); @@ -431,6 +443,7 @@ public class ApplicationType extends ResourceType { return title; } + @Override public void setTitle(String title) { Assert.exists(title, "title"); @@ -438,6 +451,7 @@ public class ApplicationType extends ResourceType { } // Can return null. + @Override public String getDescription() { final String description = (String) get("description"); @@ -445,6 +459,7 @@ public class ApplicationType extends ResourceType { } // Param description can be null. + @Override public void setDescription(String description) { set("description", description); } @@ -495,6 +510,9 @@ public class ApplicationType extends ResourceType { set("hasFullPageView", new Boolean(hasFullPageView)); } + /** + * @deprecated with no replacement. + */ public boolean hasEmbeddedView() { final Boolean result = (Boolean) get("hasEmbeddedView"); @@ -537,6 +555,7 @@ public class ApplicationType extends ResourceType { * * @return A Collection of {@link PrivilegeDescriptor PrivilegeDescriptors} */ + @Override public Collection getRelevantPrivileges() { LinkedList result = new LinkedList(); @@ -556,6 +575,7 @@ public class ApplicationType extends ResourceType { *

Add an entry to the list of relevant privileges for this * ApplicationType.

*/ + @Override public void addRelevantPrivilege(PrivilegeDescriptor privilege) { addRelevantPrivilege(privilege.getName()); } @@ -564,6 +584,7 @@ public class ApplicationType extends ResourceType { *

Add an entry to the list of relevant privileges for this * ApplicationType.

*/ + @Override public void addRelevantPrivilege(String privilegeName) { OID privOID = new OID("com.arsdigita.kernel.permissions.Privilege", privilegeName); @@ -671,6 +692,7 @@ public class ApplicationType extends ResourceType { /** * Tell whether this ApplicationType is a singleton. + * @deprecated with no replacement. */ public boolean isSingleton() { final Boolean result = (Boolean) get("isSingleton"); @@ -685,6 +707,7 @@ public class ApplicationType extends ResourceType { * * @return the value of the ID property. */ + @Override public BigDecimal getID() { BigDecimal id = (BigDecimal)get("id"); diff --git a/ccm-core/src/com/arsdigita/web/Web.java b/ccm-core/src/com/arsdigita/web/Web.java index 626259620..7fcb02b96 100755 --- a/ccm-core/src/com/arsdigita/web/Web.java +++ b/ccm-core/src/com/arsdigita/web/Web.java @@ -64,9 +64,10 @@ public class Web { private static WebConfig s_config; - final static void init(final HttpServletRequest sreq, - final ServletContext sc, - final UserContext uc) { + static void init(final HttpServletRequest sreq, + final ServletContext sc, + final UserContext uc) { + Assert.exists(sreq, HttpServletRequest.class); Assert.exists(sc, ServletContext.class); Assert.exists(uc, UserContext.class); @@ -386,10 +387,12 @@ public class Web { } private static class WebContextLocal extends InternalRequestLocal { + @Override protected Object initialValue() { return Web.s_initialContext.copy(); } + @Override protected void clearValue() { ((WebContext) get()).clear(); } diff --git a/ccm-core/src/com/arsdigita/web/WebContext.java b/ccm-core/src/com/arsdigita/web/WebContext.java index dd8f97bf9..cf9e0c1f9 100755 --- a/ccm-core/src/com/arsdigita/web/WebContext.java +++ b/ccm-core/src/com/arsdigita/web/WebContext.java @@ -59,6 +59,11 @@ public final class WebContext extends Record { super(WebContext.class, s_log, s_fields); } + /** + * Creates a copy of this WebContext + * + * @return a new WebContext as a copy of this one + */ final WebContext copy() { WebContext result = new WebContext(); @@ -68,6 +73,11 @@ public final class WebContext extends Record { return result; } + /** + * Initializes this WebContext object and setting its properties. + * @param app + * @param requestURL + */ final void init(final Application app, final URL requestURL) { setApplication(app); setRequestURL(requestURL); @@ -88,20 +98,36 @@ public final class WebContext extends Record { } } + /** + * + * @return + */ public final Application getApplication() { return m_application; } + /** + * + * @param app + */ final void setApplication(final Application app) { m_application = app; mutated("Application"); } + /** + * + * @return + */ public final URL getRequestURL() { return m_requestURL; } + /** + * + * @param url + */ final void setRequestURL(final URL url) { Assert.exists(url, "URL url");