From bc86f0b3be5421cdd3ad5bcfba9945bcf49def0f Mon Sep 17 00:00:00 2001 From: pb Date: Thu, 29 Mar 2012 21:57:35 +0000 Subject: [PATCH] Diverse Formatierungen. git-svn-id: https://svn.libreccm.org/ccm/trunk@1561 8810af33-2d31-482b-a856-94f89814c4df --- .../src/com/arsdigita/auth/http/Loader.java | 12 ++-- .../src/com/arsdigita/bookmarks/Bookmark.java | 43 +++++++++-- .../arsdigita/bookmarks/BookmarksServlet.java | 2 +- .../com/arsdigita/bookmarks/Initializer.java | 3 +- .../src/com/arsdigita/bookmarks/Loader.java | 13 ++-- .../src/com/arsdigita/cms/Initializer.java | 42 ----------- .../com/arsdigita/cms/docmgr/Initializer.java | 71 +++++++++---------- .../src/com/arsdigita/docrepo/Loader.java | 32 +++------ .../src/com/arsdigita/docrepo/Repository.java | 8 +-- .../com/arsdigita/docrepo/ui/DRServlet.java | 66 ++++++++--------- ccm-faq/src/com/arsdigita/faq/Faq.java | 40 ++++++++--- ccm-forum/src/com/arsdigita/forum/Forum.java | 1 + .../com/arsdigita/london/atoz/AddAtoZ.java | 5 +- .../src/com/arsdigita/london/atoz/Loader.java | 4 -- .../com/arsdigita/london/search/Loader.java | 4 -- .../com/arsdigita/portalserver/Loader.java | 58 ++++++++------- .../SciPublicationsLoader.java | 33 --------- .../com/arsdigita/simplesurvey/Loader.java | 4 -- 18 files changed, 180 insertions(+), 261 deletions(-) diff --git a/ccm-auth-http/src/com/arsdigita/auth/http/Loader.java b/ccm-auth-http/src/com/arsdigita/auth/http/Loader.java index 6406dfc11..8ba0d37e4 100755 --- a/ccm-auth-http/src/com/arsdigita/auth/http/Loader.java +++ b/ccm-auth-http/src/com/arsdigita/auth/http/Loader.java @@ -83,12 +83,12 @@ public class Loader extends PackageLoader { * instantiates a (single) default instance. */ private void setupHTTPAuth() { -/* - ApplicationType type = ApplicationType - .createApplicationType("auth-http", - "CCM HTTP Authentication Admin", - HTTPAuth.BASE_DATA_OBJECT_TYPE); -*/ + + // ApplicationType type = ApplicationType + // .createApplicationType("auth-http", + // "CCM HTTP Authentication Admin", + // HTTPAuth.BASE_DATA_OBJECT_TYPE); + /* Create new type legacy free application type * NOTE: The wording in the title parameter of ApplicationType diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java index 6105a42f4..6d5ec8e68 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/Bookmark.java @@ -28,7 +28,10 @@ import com.arsdigita.util.Assert; import java.math.BigDecimal; /** - * Represents a single bookmark. + * Main domain class of the Bookmark application. + * + * Main entry point into Bookmarks and provides services to save and retrieve + * bookmarks. * * @author Jim Parsons */ @@ -46,14 +49,30 @@ public class Bookmark extends ACSObject { public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.workspace.Bookmark"; + /** + * Retrieve base DataObject for client classes. + * @return + */ + @Override protected String getBaseDataObjectType() { return BASE_DATA_OBJECT_TYPE; } + /** + * Constructor + * + * @param dataObject + */ public Bookmark(DataObject dataObject) { super(dataObject); } + /** + * Constructor + * + * @param name + * @param URLstring + */ public Bookmark(String name, String URLstring) { super(BASE_DATA_OBJECT_TYPE); @@ -65,9 +84,8 @@ public class Bookmark extends ACSObject { setVisits(0); } - /** - * Retrieve an existing Bookmark based on an ID. + * Constructor retrieving an existing Bookmark based on an ID. * */ public static Bookmark retrieveBookmark(BigDecimal bmrkID) { @@ -77,7 +95,7 @@ public class Bookmark extends ACSObject { } /** - * Retrieve an existing Bookmark based on a data object. + * Constructor retrieving an existing Bookmark based on a data object. * * @param dataObject the data object of the Bookmark to retrieve. * @return an existing Bookmark. Note that the return value may be @@ -104,6 +122,10 @@ public class Bookmark extends ACSObject { return Bookmark.retrieveBookmark(dataObject); } + /** + * + * @return + */ public Bookmarks getBookmarkApplication() { if(m_bmrkapp == null) { DataObject bmrkdata = (DataObject)get("bookmarkapp"); @@ -114,11 +136,19 @@ public class Bookmark extends ACSObject { return m_bmrkapp; } + /** + * + * @param bmrkapp + */ public void setBookmarkApplication(Bookmarks bmrkapp) { m_bmrkapp = bmrkapp; setAssociation("bookmarkapp",bmrkapp); } + /** + * + * @return + */ public static BookmarkCollection retrieveAllBookmarks() { DataCollection dataCollection = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); @@ -129,9 +159,9 @@ public class Bookmark extends ACSObject { return bmrkCollection; } - // + // /////////////////////////////////////////////////////////////////////// // Accessors - // + // /////////////////////////////////////////////////////////////////////// /** * Get the title of this Bookmark. @@ -348,6 +378,7 @@ public class Bookmark extends ACSObject { set("sortKey", new Integer(sortKey)); } + @Override protected void afterSave() { super.afterSave(); PermissionService.setContext(this, getBookmarkApplication()); diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksServlet.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksServlet.java index 54bdb35bd..2012f7ce8 100644 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksServlet.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksServlet.java @@ -38,7 +38,7 @@ import org.apache.log4j.Logger; /** - * Web Developer Support Application Servlet class, central entry point to + * Bookmarks Application Servlet class, central entry point to * create and process the applications UI. * * We should have subclassed BebopApplicationServlet but couldn't overwrite diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/Initializer.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/Initializer.java index 084e264af..6777b7b5b 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/Initializer.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/Initializer.java @@ -40,8 +40,7 @@ import org.apache.log4j.Logger; public class Initializer extends CompoundInitializer { /** Creates a s_logging category with name = full name of class */ - private static final Logger s_log = Logger.getLogger - (Initializer.class); + private static final Logger s_log = Logger.getLogger(Initializer.class); /** * diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/Loader.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/Loader.java index 8e35daf8f..dc7c2f44e 100644 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/Loader.java +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/Loader.java @@ -33,16 +33,11 @@ import org.apache.log4j.Logger; /** *

Executes nonrecurring at install time and loads (installs and initializes) - * the HTTP Auth application and type persistently into database.

+ * the Bookmarks application and type persistently into database.

* * @author Daniel Berrange * @version $Id: Loader.java 287 2005-02-22 00:29:02Z sskracic $ */ - -/** - * - * @author pb - */ public class Loader extends PackageLoader { /** Creates a s_logging category with name = full name of class */ @@ -58,7 +53,8 @@ public class Loader extends PackageLoader { setEffectiveParty(Kernel.getSystemParty()); ApplicationType bmrkAppType = loadBookmarksApp(); - loadBookmarksPortlet(bmrkAppType); + loadBookmarksPortletType(bmrkAppType); + setupDefaultBookmarkApplicationInstance(); } @@ -88,7 +84,7 @@ public class Loader extends PackageLoader { return type; } - private void loadBookmarksPortlet(ApplicationType bmrkAppType ) { + private void loadBookmarksPortletType(ApplicationType bmrkAppType ) { AppPortletType type = AppPortletType.createAppPortletType( "Portal Bookmarks", @@ -120,7 +116,6 @@ public class Loader extends PackageLoader { Bookmarks app = Bookmarks.create("bookmarks", "Bookmarks", admin); s_log.debug("Bookmarks instance " + " created."); - s_log.debug("Done loading bookmarks."); } } diff --git a/ccm-cms/src/com/arsdigita/cms/Initializer.java b/ccm-cms/src/com/arsdigita/cms/Initializer.java index 6a8108506..2e207c1c1 100755 --- a/ccm-cms/src/com/arsdigita/cms/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/Initializer.java @@ -112,50 +112,11 @@ public class Initializer extends CompoundInitializer { ("ccm-cms.pdl.mf", new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); - // Step 1: - // Old type initializer "com.arsdigita.cms.installer.Initializer" - // Used to be the first initializer in old enterprise.init - // - // Replaced by new type initializer com.arsdigita.cms.installer.Initializer() - // Simple migration of the old code to the new initializer system with as - // less code change as possible. - // - // Invokes ContentCenterSetup (without any LegacyInitializer) - // performs mainly loader tasks and should be migrated to Loader. - // add(new com.arsdigita.cms.installer.Initializer()); - - // Step 2: - // Old type initializer "com.arsdigita.cms.installer.xml.ContentTypeInitializer" - // Completely moved into Loader - - // Step 4: - // Old type initializer "com.arsdigita.cms.installer.SectionInitializer" - // Invoking the Initializer rewritten to a separate enterprise.init in - // c.ad.cms.contentsection and modified in c.ad.cms.initializer - // Mainly loader tasks, to be moved into c.ad.cms.Loader - // 2010-08-16: Moved to Loader, works OK -// add(new LegacyInitializer("com/arsdigita/cms/contentsection/enterprise.init")); - - // Step 4a new - // Initializer for content section, needed when LegacyInitializer in step 4 - // has been moved to c.ad.Loader in order to register the application and - // optionally to install additional content sections. add(new com.arsdigita.cms.contentsection.Initializer()); - - // Used to be step 3 in old enterprise.init migrated to loader/new init. add(new com.arsdigita.cms.publishToFile.Initializer()); - // Used to be step 6 in old enterprise.init migrated to loader/new init. add(new com.arsdigita.cms.lifecycle.Initializer()); - // Used to be step 7 in old enterprise.init migrated to loader/new init. add(new com.arsdigita.cms.portlet.Initializer()); - - // Used to be step 5 in old enterprise.init - // Old type initializer "com.arsdigita.formbuilder.installer.Initializer" - // Used to initialize CMS forms using the forms in ccm-core - // Can be replaced in ccm after ccm-core is migrated to new initializer. - // add(new LegacyInitializer("com/arsdigita/cms/enterprise.init")); - s_log.debug("CMS.Initializer.(Constructor) completed"); } @@ -163,9 +124,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 */ @Override public void init(DomainInitEvent e) { diff --git a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java index 597dd0b9e..6ce9c37c1 100755 --- a/ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java +++ b/ccm-docmgr/src/com/arsdigita/cms/docmgr/Initializer.java @@ -17,28 +17,21 @@ package com.arsdigita.cms.docmgr; import org.apache.log4j.Logger; -import com.arsdigita.cms.docmgr.DocFolder; -import com.arsdigita.cms.docmgr.Document; -import com.arsdigita.cms.docmgr.DocumentCategoryBrowserApplication; -import com.arsdigita.cms.docmgr.LegacyCategoryBrowserApplication; -import com.arsdigita.cms.docmgr.Repository; -// unused: import com.arsdigita.cms.docmgr.search.SearchUtils; -import com.arsdigita.cms.docmgr.ui.CategoryDocsNavigatorPortlet; -import com.arsdigita.cms.docmgr.ui.LegacyCategoryDocsNavigatorPortlet; +// import com.arsdigita.cms.docmgr.ui.CategoryDocsNavigatorPortlet; +// import com.arsdigita.cms.docmgr.ui.LegacyCategoryDocsNavigatorPortlet; import com.arsdigita.cms.docmgr.ui.RecentUpdatedDocsPortlet; import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObjectFactory; -// import com.arsdigita.initializer.Configuration; import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.TransactionContext; -import com.arsdigita.portal.PortletType; -import com.arsdigita.portal.apportlet.AppPortletSetup; +// import com.arsdigita.portal.PortletType; +// import com.arsdigita.portal.apportlet.AppPortletSetup; import com.arsdigita.runtime.CompoundInitializer; import com.arsdigita.runtime.DomainInitEvent; -import com.arsdigita.web.ApplicationSetup; -import com.arsdigita.web.ApplicationType; +// import com.arsdigita.web.ApplicationSetup; +// import com.arsdigita.web.ApplicationType; /** @@ -167,26 +160,27 @@ public class Initializer extends CompoundInitializer { * package exists, and if not it creates it for the first time. */ - private ApplicationType setupDocs() { - ApplicationSetup setup = new ApplicationSetup(s_log); - setup.setApplicationObjectType(Repository.BASE_DATA_OBJECT_TYPE); - setup.setKey(PACKAGE_TYPE_NAME); - setup.setTitle("Document Manager (CMS) Application"); - setup.setSingleton(false); - setup.setDescription - ("The document manager empowers users to share documents."); - setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DMDispatcher"); - setup.setInstantiator(new ACSObjectInstantiator() { - @Override - public DomainObject doNewInstance(DataObject dataObject) { - return new Repository(dataObject); - } - }); +// private ApplicationType setupDocs() { +// ApplicationSetup setup = new ApplicationSetup(s_log); +// setup.setApplicationObjectType(Repository.BASE_DATA_OBJECT_TYPE); +// setup.setKey(PACKAGE_TYPE_NAME); +// setup.setTitle("Document Manager (CMS) Application"); +// setup.setSingleton(false); +// setup.setDescription +// ("The document manager empowers users to share documents."); +// setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DMDispatcher"); +// setup.setInstantiator(new ACSObjectInstantiator() { +// @Override +// public DomainObject doNewInstance(DataObject dataObject) { +// return new Repository(dataObject); +// } +// }); +// +// return setup.run(); +// } - return setup.run(); - } - private void setupDocManagerPortlet(ApplicationType provider) { +/* private void setupDocManagerPortlet(ApplicationType provider) { // Create the document manager portlet AppPortletSetup setup = new AppPortletSetup(s_log); @@ -203,9 +197,9 @@ public class Initializer extends CompoundInitializer { }); setup.run(); - } + } */ - private ApplicationType setupCategoryBrowsing() { +/* private ApplicationType setupCategoryBrowsing() { ApplicationSetup setup = new ApplicationSetup(s_log); setup.setApplicationObjectType(DocumentCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE); setup.setKey(CATEGORY_PACKAGE_TYPE_NAME); @@ -225,8 +219,9 @@ public class Initializer extends CompoundInitializer { }); return setup.run(); - } - private ApplicationType setupLegacyCategoryBrowsing() { + } */ + +/* private ApplicationType setupLegacyCategoryBrowsing() { ApplicationSetup setup = new ApplicationSetup(s_log); setup.setApplicationObjectType(LegacyCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE); setup.setKey(LEGACY_PACKAGE_TYPE_NAME); @@ -246,8 +241,8 @@ public class Initializer extends CompoundInitializer { }); return setup.run(); - } - + } */ +/* private void setupCategoryDocsPortlet(ApplicationType provider) { // Create the document manager portlet AppPortletSetup setup = new AppPortletSetup(s_log); @@ -285,7 +280,7 @@ public class Initializer extends CompoundInitializer { setup.run(); } - +*/ /** * Shutdown the document manager. diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java b/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java index ca32ba4e2..ed2e4b393 100644 --- a/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java +++ b/ccm-docrepo/src/com/arsdigita/docrepo/Loader.java @@ -38,7 +38,7 @@ import org.apache.log4j.Logger; * * @author pboy <pboy@barkhof.uni-bremen.de> * @version $Id: Loader.java $ - **/ + */ public class Loader extends PackageLoader { @@ -76,33 +76,17 @@ public class Loader extends PackageLoader { /** * Creates a document repository application type, the domain class of the - * document repository (docrepo) package, as a legacy-compatible type of - * application. + * document repository (docrepo) package. * - * Creates an entry in table application_types and a corresponding entry in - * apm_package_types - * - * TODO: migrate to a new style, legacy free application type. */ private void loadDocRepositoryApplicationType() { - /* Legacy compatible initialization */ - // ApplicationType type = ApplicationType.createApplicationType( - // "docrepo", - // "Document Repository", - // Repository.BASE_DATA_OBJECT_TYPE); - // Current code requires an apps specific dispatcher class. Has to be - // modified to be able to create a legacy free app type. - // type.setDispatcherClass - // ("com.arsdigita.docrepo.ui.DRDispatcher"); - - /* Legacy free initialization - * 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. - * Example: "DocRepo" will become "docrepo". + /* 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. + * Example: "DocRepo" will become "docrepo". */ ApplicationType type = new ApplicationType("DocRepo", diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java b/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java index 8417dfd66..17802c325 100644 --- a/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java +++ b/ccm-docrepo/src/com/arsdigita/docrepo/Repository.java @@ -26,22 +26,15 @@ import com.arsdigita.kernel.Group; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.Party; -//import com.arsdigita.kernel.SiteNode; import com.arsdigita.kernel.User; -// import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionService; -//import com.arsdigita.kernel.permissions.PrivilegeDescriptor; -//import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.SessionManager; -//import com.arsdigita.persistence.Session; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.util.UncheckedWrapperException; - import com.arsdigita.web.Application; import com.arsdigita.web.Web; -//import com.arsdigita.web.ApplicationCollection; import com.arsdigita.util.Assert; import java.math.BigDecimal; @@ -324,6 +317,7 @@ public class Repository extends Application { } return null; } + /** * Returns the servletPath part of the URL to the application servlet. * (see Servlet API specification or web.URL for more information) diff --git a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java index 819155960..7275828ad 100644 --- a/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java +++ b/ccm-docrepo/src/com/arsdigita/docrepo/ui/DRServlet.java @@ -31,13 +31,6 @@ import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.docrepo.File; -// import com.arsdigita.docrepo.ui.BrowsePane; -// import com.arsdigita.docrepo.ui.DocrepoBasePage; -// import com.arsdigita.docrepo.ui.DRConstants; -// import com.arsdigita.docrepo.ui.DRUtils; -// import com.arsdigita.docrepo.ui.FileInfoHistoryPane; -// import com.arsdigita.docrepo.ui.FileInfoPropertiesPane; -// import com.arsdigita.docrepo.ui.RepositoryPane; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.persistence.DataQuery; @@ -49,16 +42,15 @@ import com.arsdigita.util.Assert; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.Application; import com.arsdigita.web.BaseApplicationServlet; +import com.arsdigita.web.Web; import com.arsdigita.xml.Document; -import com.arsdigita.web.Web; import java.io.*; - import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; -import javax.servlet.ServletException; +import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -68,17 +60,16 @@ import org.apache.log4j.Logger; * Application servlet for the ccm-docrepo application, serves all request made * for the application's UI. * - * URLs of the available services are stored in a XML file which is processed - * into a cache of services on a request by request basis (lazy loading). + * DRServlet is called by BaseApplicationServlet which has determined that + * DRServlet is associated with a request URL. * - * ServiceServlet is called by BaseApplicationServlet which has determined that - * ServiceServlet is associated with a request URL. + * The servlet has to be included in servlet container's deployment descriptor, + * see {@see com.arsdigita.docrepo.Repository#getServletPath()} for details + * about web.xml record. It is NOT directly referenced by any other class. * - * The CMS Service determines whether a Page has been registered to - * the URL and if so passes the request to that page. - * - * If no Page is registered to the URL, then the CMS Service hands - * the request to the TemplateResolver to find an appropriate JSP file. + * It determines whether a Page has been registered to the URL and + * if so passes the request to that page. Otherwise it hands the request + * to the TemplateResolver to find an appropriate JSP file. * * @author Stefan Deusch * @author Peter Boy @@ -109,6 +100,7 @@ public class DRServlet extends BaseApplicationServlet addPage("/file", buildFileInfoPage()); } + /** * Implements the (abstract) doService method of BaseApplicationServlet to * perform the services. @@ -168,31 +160,31 @@ public class DRServlet extends BaseApplicationServlet s_log.debug("show repository page"); // super.dispatch(req, resp, ctx); - String pathInfo = sreq.getPathInfo(); - Assert.exists(pathInfo, "String pathInfo"); - if (pathInfo.length() > 1 && pathInfo.endsWith("/")) { - /* NOTE: ServletAPI specifies, pathInfo may be empty or will - * start with a '/' character. It currently carries a - * trailing '/' if a "virtual" page, i.e. not a real jsp, but - * result of a servlet mapping. But Application requires url - * NOT to end with a trailing '/' for legacy free applications. */ - pathInfo = pathInfo.substring(0, pathInfo.length()-1); - } + String pathInfo = sreq.getPathInfo(); + Assert.exists(pathInfo, "String pathInfo"); + if (pathInfo.length() > 1 && pathInfo.endsWith("/")) { + /* NOTE: ServletAPI specifies, pathInfo may be empty or will + * start with a '/' character. It currently carries a + * trailing '/' if a "virtual" page, i.e. not a real jsp, but + * result of a servlet mapping. But Application requires url + * NOT to end with a trailing '/' for legacy free applications. */ + pathInfo = pathInfo.substring(0, pathInfo.length()-1); + } - final Page page = (Page) m_pages.get(pathInfo); + final Page page = (Page) m_pages.get(pathInfo); - if (page != null) { + if (page != null) { - final Document doc = page.buildDocument(sreq, sresp); + final Document doc = page.buildDocument(sreq, sresp); - PresentationManager pm = Templating.getPresentationManager(); - pm.servePage(doc, sreq, sresp); + PresentationManager pm = Templating.getPresentationManager(); + pm.servePage(doc, sreq, sresp); - } else { + } else { - sresp.sendError(404, "No such page for path " + pathInfo); + sresp.sendError(404, "No such page for path " + pathInfo); - } + } } diff --git a/ccm-faq/src/com/arsdigita/faq/Faq.java b/ccm-faq/src/com/arsdigita/faq/Faq.java index 9db0aa225..f528462b8 100644 --- a/ccm-faq/src/com/arsdigita/faq/Faq.java +++ b/ccm-faq/src/com/arsdigita/faq/Faq.java @@ -33,7 +33,10 @@ import java.math.BigDecimal; import org.apache.log4j.Logger; /** - * Faq class. + * Application domain class for the Faq application. + * + * It manages creation of new Faq instances and provides getters and setters + * for instance specific items. * * @version $Id: com/arsdigita/faq/Faq.java#5 $ */ @@ -44,7 +47,6 @@ public class Faq extends Application { private static final Logger log = Logger.getLogger(Faq.class); // PDL stuff - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.faq.Faq"; @@ -107,14 +109,6 @@ public class Faq extends Application { new TypedText(answer, TypedText.TEXT_HTML)); } -// /** -// * @deprecated use createQuestion(String, TypedText) instead -// */ -// public QAPair createQuestion(String question, String answer, -// String answerFormat) { -// return createQuestion(question, new TypedText(answer, answerFormat)); -// } - public QAPair createQuestion(String question, TypedText answer) { Integer sortKey = getNextSortKey(); @@ -183,6 +177,32 @@ public class Faq extends Application { } + + /** + * Returns the path name of the location of the applications servlet/JSP. + * + * The method overwrites the super class to provide an application specific + * location for servlets/JSP. This is necessary if you whish to install the + * module (application) along with others in one context. If you install the + * module into its own context (no longer recommended) you may use a + * standard location. + * + * Usually it is a symbolic name/path, which will be mapped in the web.xml + * to the real location in the file system. Example: + * + * faq + * com.arsdigita.faq.Faq + * + * + * + * faq + * /faq/* + * + * + * The appended "/*" ensures BaseServlet will find additional JSP's. + * + * @return path name to the applications servlet/JSP + */ @Override public String getServletPath() { return "/faq"; diff --git a/ccm-forum/src/com/arsdigita/forum/Forum.java b/ccm-forum/src/com/arsdigita/forum/Forum.java index d9b5c926e..87cf57ea7 100755 --- a/ccm-forum/src/com/arsdigita/forum/Forum.java +++ b/ccm-forum/src/com/arsdigita/forum/Forum.java @@ -1037,6 +1037,7 @@ public class Forum extends Application { // public String getContextPath() { // return "/ccm-forum"; // } + /** * Returns the path name of the location of the applications servlet/JSP. * diff --git a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java index 34d0a4203..577285d1d 100755 --- a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java +++ b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java @@ -6,16 +6,13 @@ import org.apache.log4j.Logger; import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectInstantiator; -import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.london.util.Program; import com.arsdigita.london.util.Transaction; import com.arsdigita.persistence.DataObject; import com.arsdigita.web.Application; -import com.arsdigita.web.ApplicationSetup; -import com.arsdigita.web.ApplicationType; -import com.arsdigita.web.ApplicationTypeCollection; + public class AddAtoZ extends Program { diff --git a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/Loader.java b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/Loader.java index 1bad08bbb..d8a54f717 100755 --- a/ccm-ldn-atoz/src/com/arsdigita/london/atoz/Loader.java +++ b/ccm-ldn-atoz/src/com/arsdigita/london/atoz/Loader.java @@ -18,15 +18,11 @@ package com.arsdigita.london.atoz; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.loader.PackageLoader; -import com.arsdigita.persistence.DataObject; import com.arsdigita.runtime.ScriptContext; import com.arsdigita.web.Application; -import com.arsdigita.web.ApplicationSetup; import com.arsdigita.web.ApplicationType; import org.apache.log4j.Logger; diff --git a/ccm-ldn-search/src/com/arsdigita/london/search/Loader.java b/ccm-ldn-search/src/com/arsdigita/london/search/Loader.java index ea24eb1be..e93ba1e95 100755 --- a/ccm-ldn-search/src/com/arsdigita/london/search/Loader.java +++ b/ccm-ldn-search/src/com/arsdigita/london/search/Loader.java @@ -18,15 +18,11 @@ package com.arsdigita.london.search; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.loader.PackageLoader; -import com.arsdigita.persistence.DataObject; import com.arsdigita.runtime.ScriptContext; import com.arsdigita.web.Application; -import com.arsdigita.web.ApplicationSetup; import com.arsdigita.web.ApplicationType; import org.apache.log4j.Logger; diff --git a/ccm-portalserver/src/com/arsdigita/portalserver/Loader.java b/ccm-portalserver/src/com/arsdigita/portalserver/Loader.java index 4aa69072b..9ced3c825 100644 --- a/ccm-portalserver/src/com/arsdigita/portalserver/Loader.java +++ b/ccm-portalserver/src/com/arsdigita/portalserver/Loader.java @@ -137,17 +137,15 @@ public class Loader extends PackageLoader { private void loadPortalSiteApplicationType() { /* First try: create a new style, legacy compatible application */ -/* - ApplicationType type = ApplicationType.createApplicationType( - "portalsite", - "Portal Site", - PortalSite.BASE_DATA_OBJECT_TYPE); + + // ApplicationType type = ApplicationType.createApplicationType( + // "portalsite", + // "Portal Site", + // PortalSite.BASE_DATA_OBJECT_TYPE); // Current code requires an apps specific dispatcher class. Has to be // modified to be able to create a legacy free app type. - type.setDispatcherClass - ("com.arsdigita.portalserver.ui.PortalDispatcher"); - -*/ + // type.setDispatcherClass + // ("com.arsdigita.portalserver.ui.PortalDispatcher"); // Try: new style legacy free application ApplicationType type = new @@ -230,16 +228,16 @@ public class Loader extends PackageLoader { // in applications mit primary_url=/portal-admin/ // in acs_object mit default_domain_class=c.ad.ps.admin.PSAdmin und // object_type=c.ad.admin.CWAdmin, ebenfalls wg. BASE_DATA_OBJ_TYPE -/* - ApplicationType type = ApplicationType.createApplicationType( - "portal-admin", - "Portal Server Site Administration", - PSAdmin.BASE_DATA_OBJECT_TYPE); - // Current code requires an apps specific dispatcher class. Has to be - // modified to be able to create a legacy free app type. - type.setDispatcherClass - ("com.arsdigita.portalserver.admin.ui.Dispatcher"); -*/ + + // ApplicationType type = ApplicationType.createApplicationType( + // "portal-admin", + // "Portal Server Site Administration", + // PSAdmin.BASE_DATA_OBJECT_TYPE); + // // Current code requires an apps specific dispatcher class. Has to be + // // modified to be able to create a legacy free app type. + // type.setDispatcherClass + // ("com.arsdigita.portalserver.admin.ui.Dispatcher"); + // Try: new style legacy free application ApplicationType type = new ApplicationType("Portal Admin", // title @@ -259,17 +257,17 @@ public class Loader extends PackageLoader { private void loadPortalCreatorApplicationType() { // formerly private ApplicationType setupPortalCreator() { in ui.admin.Initializer -/* - ApplicationType type = ApplicationType.createApplicationType( - "portal-create", - "Portal Creator", - PortalCreator.BASE_DATA_OBJECT_TYPE); - type.setDescription ("Creates portals."); - // Current code requires an apps specific dispatcher class. Has to be - // modified to be able to create a legacy free app type. - type.setDispatcherClass - ("com.arsdigita.portalserver.ui.admin.PortalCreateDispatcher"); -*/ + + // ApplicationType type = ApplicationType.createApplicationType( + // "portal-create", + // "Portal Creator", + // PortalCreator.BASE_DATA_OBJECT_TYPE); + // type.setDescription ("Creates portals."); + // // Current code requires an apps specific dispatcher class. Has to be + // // modified to be able to create a legacy free app type. + // type.setDispatcherClass + // ("com.arsdigita.portalserver.ui.admin.PortalCreateDispatcher"); + // Try: new style legacy free application ApplicationType type = new diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/SciPublicationsLoader.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/SciPublicationsLoader.java index a178e40d7..16cde54e0 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/SciPublicationsLoader.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/SciPublicationsLoader.java @@ -1,14 +1,10 @@ package com.arsdigita.cms.scipublications; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.loader.PackageLoader; -import com.arsdigita.persistence.DataObject; import com.arsdigita.runtime.ScriptContext; import com.arsdigita.web.Application; -import com.arsdigita.web.ApplicationSetup; import com.arsdigita.web.ApplicationType; import org.apache.log4j.Logger; @@ -30,35 +26,6 @@ public class SciPublicationsLoader extends PackageLoader { protected void excurse() { setEffectiveParty(Kernel.getSystemParty()); - /*ApplicationSetup setup = new ApplicationSetup(logger); - - setup.setApplicationObjectType( - SciPublications.BASE_DATA_OBJECT_TYPE); - setup.setKey("scipubliations"); - setup.setTitle("sci-publications"); - setup.setDescription( - "Provides several functions like export and import for publications."); - //setup.setSingleton(true); - setup.setInstantiator(new ACSObjectInstantiator() { - @Override - public DomainObject doNewInstance(DataObject dataObject) { - return new SciPublications(dataObject); - } - }); - - ApplicationType type = setup.run(); - type.save(); - - //Install the application and mount the app at 'scipublications'. - if (!Application.isInstalled( - SciPublications.BASE_DATA_OBJECT_TYPE, "/scipublications/")) { - Application app = Application.createApplication(type, - "scipublications", - "SciPublications", - null); - app.save(); - }*/ - final ApplicationType type = new ApplicationType( "SciPublications", SciPublications.BASE_DATA_OBJECT_TYPE); diff --git a/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java b/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java index 0c2e976ae..44b0d8355 100755 --- a/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java +++ b/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java @@ -18,16 +18,12 @@ */ package com.arsdigita.simplesurvey; -import com.arsdigita.domain.DomainObject; import com.arsdigita.formbuilder.util.FormbuilderSetup; -import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.loader.PackageLoader; -import com.arsdigita.persistence.DataObject; import com.arsdigita.runtime.ScriptContext; import com.arsdigita.web.Application; -import com.arsdigita.web.ApplicationSetup; import com.arsdigita.web.ApplicationType; import java.util.Arrays;