Complex and big update:

- removed dependencies from ~/sitenode/SiteNodeRequestContext
- refactored ContentCenterServlet to use clean new style application code
- removed dispatcher base code from ContentCenter main page
- refactored root index.jsp to check for logged in user and redirect tu user page
- added permission check to ContentCenterServlet and removed content-center redirect.jsp
- removed old package dependen admin / sitemap application
- added various documentation and improved formatting



git-svn-id: https://svn.libreccm.org/ccm/trunk@2047 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-01-23 14:04:16 +00:00
parent 2d011e2f62
commit 6bc125dbca
87 changed files with 1215 additions and 1157 deletions

View File

@ -0,0 +1,5 @@
Version 6.6.8
- Remove Dependency from SiteNodeRequestContext
(Starting with removal of SNRC in core web.BaseApplicationServlet)
- Refactored content-center from dispatcher mechanism to bebop page

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-cms" name="ccm-cms"
prettyName="Red Hat CCM Content Management System" prettyName="Red Hat CCM Content Management System"
version="6.6.7" version="6.6.8"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>

View File

@ -21,7 +21,7 @@ model com.arsdigita.cms;
import com.arsdigita.kernel.*; import com.arsdigita.kernel.*;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
object type Workspace extends Application { object type ContentCenter extends Application {
// nothing to persist yet // nothing to persist yet
// reference key (cms_workspace.workspace_id); // reference key (cms_contentcenter.contentcenter_id);
} }

View File

@ -21,10 +21,7 @@ package com.arsdigita.cms;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.web.Application; import com.arsdigita.web.*;
import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType;
import com.arsdigita.web.URL;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -35,15 +32,16 @@ import org.apache.log4j.Logger;
* Application domain class for the CMS module user entry page (content-center) * Application domain class for the CMS module user entry page (content-center)
* *
* @author pb * @author pb
* @version $Id: Workspace.java $ * @version $Id: ContentCenter.java $
*/ */
public class Workspace extends Application { public class ContentCenter extends Application {
/** A logger instance, primarily to assist debugging . */
private static final Logger s_log = Logger.getLogger(ContentSection.class); private static final Logger s_log = Logger.getLogger(ContentSection.class);
// pdl stuff (constants) // pdl stuff (constants)
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.Workspace"; "com.arsdigita.cms.ContentCenter";
// general constants // general constants
public static final String PACKAGE_KEY = "content-center"; public static final String PACKAGE_KEY = "content-center";
@ -57,7 +55,7 @@ public class Workspace extends Application {
* @param oid the OID of the workspace (content-center) * @param oid the OID of the workspace (content-center)
* @throws DataObjectNotFoundException * @throws DataObjectNotFoundException
*/ */
public Workspace(OID oid) throws DataObjectNotFoundException { public ContentCenter(OID oid) throws DataObjectNotFoundException {
super(oid); super(oid);
} }
@ -68,14 +66,14 @@ public class Workspace extends Application {
* @param id The <code>id</code> for the retrieved * @param id The <code>id</code> for the retrieved
* <code>DataObject</code>. * <code>DataObject</code>.
*/ */
public Workspace(BigDecimal key) throws DataObjectNotFoundException { public ContentCenter(BigDecimal key) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, key)); this(new OID(BASE_DATA_OBJECT_TYPE, key));
} }
/** /**
* Constructs a repository from the underlying data object. * Constructs a repository from the underlying data object.
*/ */
public Workspace(DataObject dataObject) { public ContentCenter(DataObject dataObject) {
super(dataObject); super(dataObject);
} }
@ -92,12 +90,12 @@ public class Workspace extends Application {
/** /**
* This is called when the application is created. * This is called when the application is created.
*/ */
public static Workspace create(String urlName, public static ContentCenter create(String urlName,
String title, String title,
Application parent) { Application parent) {
Workspace app = ContentCenter app =
(Workspace) Application.createApplication (ContentCenter) Application.createApplication
(BASE_DATA_OBJECT_TYPE, urlName, title, parent); (BASE_DATA_OBJECT_TYPE, urlName, title, parent);
app.save(); app.save();
@ -105,39 +103,32 @@ public class Workspace extends Application {
return app; return app;
} }
/**
* Returns an instance of the Workspace application. There must not more
* than one instance exist. May return null.
*/
public static Application getInstance() {
ApplicationType workspaceType = ApplicationType.
retrieveApplicationTypeForApplication(BASE_DATA_OBJECT_TYPE);
if ( workspaceType == null ) { return null; }
ApplicationCollection apps = Application.retrieveAllApplications();
apps.addEqualsFilter("resourceType.id", workspaceType.getID());
if ( !apps.next() ) { return null; }
Application result = apps.getApplication();
apps.close();
return result;
}
/** /**
* Fetch the location (URL) of the CMS Workspace. There must not more than * Fetch the URL of the CMS ContentCenter.
* one instance exist.
* *
* @return The URL of the CMS Workspace (currently including trailing slash) * Currently only one Content Center application installed is allowed!
* Therefore we simply may return the URL used to load and initialise the
* Content Center.
*
* @return The URL of the CMS ContentCenter (currently including trailing slash)
*/ */
public static String getURL() { public static String getURL() {
// quick 'nd dirty!
return "/"+PACKAGE_KEY;
Application app = Workspace.getInstance(); // Doesn't work as expected
if (app == null) { // see c.ad.ui.login.UserInfo for a working (hopefully) example.
return null; // ApplicationCollection apps = Application
} else { // .retrieveAllApplications(BASE_DATA_OBJECT_TYPE);
String url = (String) app.getPrimaryURL(); // if (apps.next()) {
return url; // // Note: Currently only one Content Center application is allowed!
} // s_log.error("Instance of ContentCenter found!");
// return apps.getPrimaryURL();
// } else {
// s_log.error("No instance of ContentCenter could be found!");
// return null;
// }
} }
/** /**

View File

@ -19,28 +19,31 @@
package com.arsdigita.cms; package com.arsdigita.cms;
import com.arsdigita.bebop.Page;
import com.arsdigita.cms.dispatcher.ResourceHandler; import com.arsdigita.cms.dispatcher.ResourceHandler;
import com.arsdigita.cms.dispatcher.SimpleCache; import com.arsdigita.cms.dispatcher.SimpleCache;
import com.arsdigita.cms.ui.contentcenter.MainPage;
import com.arsdigita.developersupport.DeveloperSupport; import com.arsdigita.developersupport.DeveloperSupport;
import com.arsdigita.dispatcher.AccessDeniedException;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.kernel.security.UserContext; import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.kernel.security.Util; import com.arsdigita.kernel.security.Util;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.ui.login.LoginHelper; import com.arsdigita.ui.login.LoginHelper;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.web.Application; import com.arsdigita.web.*;
import com.arsdigita.web.ApplicationFileResolver; import com.arsdigita.xml.Document;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.web.LoginSignal;
import com.arsdigita.web.Web;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import javax.servlet.RequestDispatcher; import java.util.Map;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -48,38 +51,45 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* CMS Workspace (content-center) application servlet serves all request made * CMS ContentCenter (content-center) application servlet serves all request
* within the Content Center application. * made within the Content Center application.
* *
* @author Peter Boy <pboy@barkhof.uni-bremen.de> * @author Peter Boy <pboy@barkhof.uni-bremen.de>
* @version $Id: WorkspaceServlet.java 2161 2011-02-02 00:16:13Z pboy $ * @version $Id: ContentCenterServlet.java 2161 2011-02-02 00:16:13Z pboy $
*/ */
public class WorkspaceServlet extends BaseApplicationServlet { public class ContentCenterServlet extends BaseApplicationServlet {
/**Error logging */ /** Logger instance for debugging */
private static Logger s_log = Logger private static Logger s_log = Logger
.getLogger(WorkspaceServlet.class.getName()); .getLogger(ContentCenterServlet.class.getName());
// DEPRECATED STUFF follows. Should be no longer used, deleted in future!
/** The path of the file that maps resources. */ /** The path of the file that maps resources. */
public final static String DEFAULT_MAP_FILE = public final static String DEFAULT_MAP_FILE =
"/WEB-INF/resources/content-center-old-map.xml"; "/WEB-INF/resources/content-center-old-map.xml";
/** Mapping between a relative URL and the class name of a ResourceHandler.*/ /** Mapping between a relative URL and the class name of a ResourceHandler.*/
private static HashMap s_pageClasses = WorkspaceSetup.getURLToClassMap(); private static HashMap s_pageClasses = ContentCenterSetup.getURLToClassMap();
private static HashMap s_pageURLs = WorkspaceSetup.getClassToURLMap(); private static HashMap s_pageURLs = ContentCenterSetup.getClassToURLMap();
/** /** Instantiated ResourceHandlers cache. This allows for lazy loading. */
* Instantiated ResourceHandlers cache. This allows for lazy loading.
*/
private static SimpleCache s_pages = new SimpleCache(); private static SimpleCache s_pages = new SimpleCache();
// private Dispatcher m_notFoundHandler;
private ArrayList m_trailingSlashList = new ArrayList(); private ArrayList m_trailingSlashList = new ArrayList();
// NEW STUFF here used to process the pages in this servlet
/** URL (pathinfo) -> Page object mapping. Based on it (and the http
* request url) the doService method to selects a page to display */
private final Map m_pages = new HashMap();
// STUFF to use for JSP extension, i.e. jsp's to try for URLs which are not
// handled by the this servlet directly.
/** Path to directory containg ccm-cms template files */ /** Path to directory containg ccm-cms template files */
private String m_templatePath; private String m_templatePath;
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/ /** Resolvers to find templates (JSP) and other stuff stored in file system.*/
private ApplicationFileResolver m_resolver; private ApplicationFileResolver m_resolver;
@ -92,9 +102,22 @@ public class WorkspaceServlet extends BaseApplicationServlet {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.info("starting doInit method"); s_log.info("starting doInit method");
} }
// DEPRECATED STUFF for servlet internally process pages, maybe required
// for JSP extension.
m_trailingSlashList = new ArrayList(); m_trailingSlashList = new ArrayList();
requireTrailingSlash(""); requireTrailingSlash("");
// NEW STUFF here used to process the pages in this servlet
// Addresses previously noted in WEB-INF/resources/content-center-map.xml
// Obviously not required.
addPage("/", new MainPage()); // index page at address ~/ds
// addPage("/index/", new MainPage());
// addPage("/ItemSearchPage/", new CCItemSearchPage());
// addPage("/SearchResultRedirector/", new CCSearchResultRedirector());
// STUFF to use for JSP extension, i.e. jsp's to try for URLs which are not
// handled by the this servlet directly.
/** Set Template base path for JSP's */ /** Set Template base path for JSP's */
// ToDo: Make it configurable by an appropriate config registry entry! // ToDo: Make it configurable by an appropriate config registry entry!
// m_templatePath = CMS.getConfig().getTemplateRoot(); // m_templatePath = CMS.getConfig().getTemplateRoot();
@ -111,7 +134,7 @@ public class WorkspaceServlet extends BaseApplicationServlet {
/** /**
* Implements the (abstract) doService method of BaseApplicationServlet to * Implements the (abstract) doService method of BaseApplicationServlet to
* create the Workspace page. * create the ContentCenter page.
* *
* @see com.arsdigita.web.BaseApplicationServlet#doService * @see com.arsdigita.web.BaseApplicationServlet#doService
* (HttpServletRequest, HttpServletResponse, Application) * (HttpServletRequest, HttpServletResponse, Application)
@ -126,31 +149,75 @@ public class WorkspaceServlet extends BaseApplicationServlet {
} }
DeveloperSupport.startStage("ContentCenterServlet.doService"); DeveloperSupport.startStage("ContentCenterServlet.doService");
Workspace workspace = (Workspace) app; ContentCenter workspace = (ContentCenter) app;
/*
* Check user and privilegies
*/
if (Web.getContext().getUser() == null) { // user not logged in
throw new LoginSignal(sreq); // send to login page
}
// Check whether logged in user has access to at least one content section
ContentSectionCollection sections = ContentSection.getAllSections();
boolean hasAccess = false;
while (sections.next()) {
ContentSection section = sections.getContentSection();
SecurityManager sm = new SecurityManager(section);
if (sm.canAccess(sreq, SecurityManager.ADMIN_PAGES)) {
hasAccess = true;
break;
}
}
sections.close();
if (!hasAccess) { // user has no access privilege
throw new AccessDeniedException(
"User is not entitled to access any content section");
// throw new LoginSignal(sreq); // send to login page
}
RequestContext ctx = DispatcherHelper.getRequestContext(); RequestContext ctx = DispatcherHelper.getRequestContext();
String url = ctx.getRemainingURLPart(); // here SiteNodeRequestContext String url = ctx.getRemainingURLPart(); // here SiteNodeRequestContext
String originalUrl = ctx.getOriginalURL(); String originalUrl = ctx.getOriginalURL();
String requestUri = sreq.getRequestURI(); String requestUri = sreq.getRequestURI();
// New way to tetch the page
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);
}
// An empty remaining URL or a URL which doesn't end in trailing slash: // An empty remaining URL or a URL which doesn't end in trailing slash:
// probably want to redirect. // probably want to redirect.
// Probably DEPRECATED with new access method or only relevant for jsp
// extension
if ( m_trailingSlashList.contains(url) && !originalUrl.endsWith("/") ) { if ( m_trailingSlashList.contains(url) && !originalUrl.endsWith("/") ) {
DispatcherHelper.sendRedirect(sresp, originalUrl + "/"); DispatcherHelper.sendRedirect(sresp, originalUrl + "/");
return; return;
} }
// Check user access.
// checkUserAccess(sreq, sresp);
ResourceHandler page = getResource(url); // ResourceHandler page = getResource(url);
final Page page = (Page) m_pages.get(pathInfo);
if ( page != null ) { if ( page != null ) {
// Check user access. // Check user access.
checkUserAccess(sreq, sresp); checkUserAccess(sreq, sresp);
// Serve the page. // Serve the page.
page.init(); final Document doc = page.buildDocument(sreq, sresp);
page.dispatch(sreq, sresp, ctx); PresentationManager pm = Templating.getPresentationManager();
pm.servePage(doc, sreq, sresp);
// page.init();
// page.dispatch(sreq, sresp, ctx);
} else { } else {
// Fall back on the JSP application dispatcher. // Fall back on the JSP application dispatcher.
// NOTE: The JSP must ensure the proper authentication and // NOTE: The JSP must ensure the proper authentication and
@ -178,8 +245,28 @@ public class WorkspaceServlet extends BaseApplicationServlet {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.info("doService method completed"); s_log.info("doService method completed");
} }
} // END doService()
/**
* Adds one pair of Url - Page to the internal hash map, used as a cache.
*
* @param pathInfo url stub for a page to display
* @param page Page object to display
*/
private void addPage(final String pathInfo, final Page page) {
Assert.exists(pathInfo, String.class);
Assert.exists(page, Page.class);
// Current Implementation requires pathInfo to start with a leading '/'
// SUN Servlet API specifies: "PathInfo *may be empty* or will start
// with a '/' character."
Assert.isTrue(pathInfo.startsWith("/"), "path starts not with '/'");
m_pages.put(pathInfo, page);
} }
/** /**
* Service Method returns the URL stub for the class name, * Service Method returns the URL stub for the class name,
* can return null if not mapped * can return null if not mapped

View File

@ -45,9 +45,9 @@ import org.xml.sax.SAXException;
* @author Peter Boy <pboy@barkhof.uni-bremen.,de> * @author Peter Boy <pboy@barkhof.uni-bremen.,de>
* @version $Id: $ * @version $Id: $
*/ */
public final class WorkspaceSetup { public final class ContentCenterSetup {
private static Logger s_log = Logger.getLogger(WorkspaceSetup.class); private static Logger s_log = Logger.getLogger(ContentCenterSetup.class);
/** URL to access the CMS Workspace, by default content-center */ /** URL to access the CMS Workspace, by default content-center */
final String m_workspaceURL; final String m_workspaceURL;
@ -69,7 +69,7 @@ public final class WorkspaceSetup {
* @param workspaceURL * @param workspaceURL
* @param contentCenterMap * @param contentCenterMap
*/ */
public WorkspaceSetup( String workspaceURL, public ContentCenterSetup( String workspaceURL,
String contentCenterMap) { String contentCenterMap) {
m_workspaceURL = workspaceURL; m_workspaceURL = workspaceURL;

View File

@ -78,7 +78,7 @@ import org.apache.log4j.Logger;
* In a process of refactoring from legacy compatible to legacy free applications. * In a process of refactoring from legacy compatible to legacy free applications.
* TODO: * TODO:
* - replace url check using RequestContext which resolves to SiteNodeRequest * - replace url check using RequestContext which resolves to SiteNodeRequest
* implementation * implementation (due to SiteNodeRequest used in BaseApplicationServlet).
* - Refactor content item UI bebop ApplicationPage or PageFactory instead of * - Refactor content item UI bebop ApplicationPage or PageFactory instead of
* legacy infected sitenode / package dispatchers. * legacy infected sitenode / package dispatchers.
*/ */

View File

@ -108,7 +108,10 @@ public class Initializer extends CompoundInitializer {
s_log.debug("CMS.Initializer.(Constructor) invoked"); s_log.debug("CMS.Initializer.(Constructor) invoked");
add(new PDLInitializer(new ManifestSource("ccm-cms.pdl.mf", add(new PDLInitializer(new ManifestSource("ccm-cms.pdl.mf",
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); new NameFilter(DbHelper
.getDatabaseSuffix(database),
"pdl")))
);
add(new com.arsdigita.cms.contentsection.Initializer()); add(new com.arsdigita.cms.contentsection.Initializer());
add(new com.arsdigita.cms.publishToFile.Initializer()); add(new com.arsdigita.cms.publishToFile.Initializer());
@ -127,12 +130,12 @@ public class Initializer extends CompoundInitializer {
s_log.debug("CMS.Initializer.init(DomainInitEvent) invoked"); s_log.debug("CMS.Initializer.init(DomainInitEvent) invoked");
super.init(e); super.init(e);
/* Register object instantiator for Workspace (Content Center) */ /* Register object instantiator for ContentCenter (Content Center) */
e.getFactory().registerInstantiator(Workspace.BASE_DATA_OBJECT_TYPE, e.getFactory().registerInstantiator(ContentCenter.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { new ACSObjectInstantiator() {
@Override @Override
public DomainObject doNewInstance(DataObject dobj) { public DomainObject doNewInstance(DataObject dobj) {
return new Workspace(dobj); return new ContentCenter(dobj);
} }
}); });
@ -203,10 +206,10 @@ public class Initializer extends CompoundInitializer {
// cg - register Task Retrieval engine // cg - register Task Retrieval engine
Engine.registerEngine(CMSEngine.CMS_ENGINE_TYPE, new CMSEngine()); Engine.registerEngine(CMSEngine.CMS_ENGINE_TYPE, new CMSEngine());
// Setup Workspace tab to URL mapping // Setup ContentCenter tab to URL mapping
final String workspaceURL = CMS.WORKSPACE_PACKAGE_KEY; final String workspaceURL = CMS.WORKSPACE_PACKAGE_KEY;
final String contentCenterMap = s_conf.getContentCenterMap(); final String contentCenterMap = s_conf.getContentCenterMap();
WorkspaceSetup workspaceSetup = new WorkspaceSetup(workspaceURL, ContentCenterSetup workspaceSetup = new ContentCenterSetup(workspaceURL,
contentCenterMap); contentCenterMap);
workspaceSetup.run(); workspaceSetup.run();

View File

@ -52,11 +52,10 @@ import org.apache.log4j.Logger;
* *
* <p>This class also optionally initializes user-defined content types. </p> * <p>This class also optionally initializes user-defined content types. </p>
* <p>Additional user-defined content sections can be loaded and initilized * <p>Additional user-defined content sections can be loaded and initilized
* using the recurring * using the recurring <pre>initializer</pre> at any startup.
* <pre>initializer</pre> at any startup.
* *
* <p>The tasks to perform are:</p> <ol> <li>create CMS package * <p>The tasks to perform are:</p> <ol> <li>create CMS package
* type(content-section)</li> <li>create Workspace package type and * type(content-section)</li> <li>create ContentCenter package type and
* instance</li> <li>create CMS Service package type and instance</li> * instance</li> <li>create CMS Service package type and instance</li>
* <li>create CMS package (content-section) instance</li> </ol> * <li>create CMS package (content-section) instance</li> </ol>
* *
@ -134,9 +133,9 @@ public class Loader extends PackageLoader {
public void excurse() { public void excurse() {
setEffectiveParty(Kernel.getSystemParty()); setEffectiveParty(Kernel.getSystemParty());
// Step 1) Setup the CMS Workspace // Step 1) Setup the CMS ContentCenter
ApplicationType appType = loadWorkspaceApplicationType(); ApplicationType appType = loadContentCenterApplicationType();
setupDefaultWorkspaceApplicationInstance(appType); setupDefaultContentCenterApplicationInstance(appType);
// Step 2) Setup the CMS global services // Step 2) Setup the CMS global services
appType = loadServiceApplicationType(); appType = loadServiceApplicationType();
@ -168,14 +167,14 @@ public class Loader extends PackageLoader {
} }
/** /**
* Loads the Workspace subpackage (content-center) into the database. * Loads the ContentCenter subpackage (content-center) into the database.
* *
* It is made public to be able to invoke it from the update script (e.g. * It is made public to be able to invoke it from the update script (e.g.
* 6.6.1-6.6.2). We need separate steps for loading and instantiating * 6.6.1-6.6.2). We need separate steps for loading and instantiating
* because update skript requires. * because update skript requires.
*/ */
public static ApplicationType loadWorkspaceApplicationType() { public static ApplicationType loadContentCenterApplicationType() {
s_log.debug("Creating CMS Workspace..."); s_log.debug("Creating CMS ContentCenter...");
/* /*
* Create new type legacy free application type NOTE: The wording in the * Create new type legacy free application type NOTE: The wording in the
@ -185,18 +184,18 @@ public class Loader extends PackageLoader {
* words and illegal characters with an hyphen and converted to lower * words and illegal characters with an hyphen and converted to lower
* case. "Content Center" will become "content-center". * case. "Content Center" will become "content-center".
*/ */
ApplicationType type = new ApplicationType(Workspace.INSTANCE_NAME, ApplicationType type = new ApplicationType(ContentCenter.INSTANCE_NAME,
Workspace.BASE_DATA_OBJECT_TYPE); ContentCenter.BASE_DATA_OBJECT_TYPE);
type.setDescription("The content center workspace for content creators."); type.setDescription("The content center workspace for content creators.");
type.save(); type.save();
s_log.debug("CMS Workspace type created."); s_log.debug("CMS ContentCenter type created.");
return type; return type;
} }
/** /**
* Instantiates the Workspace subpackage (content-center) (in the database). * Instantiates the ContentCenter subpackage (content-center) (in the database).
* *
* It is made public to be able to invoke it from the update script (e.g. * It is made public to be able to invoke it from the update script (e.g.
* 6.6.1-6.6.2). We need separate steps for loading and instantiating * 6.6.1-6.6.2). We need separate steps for loading and instantiating
@ -204,25 +203,26 @@ public class Loader extends PackageLoader {
* *
* @param workspaceType * @param workspaceType
*/ */
public static void setupDefaultWorkspaceApplicationInstance( public static void setupDefaultContentCenterApplicationInstance(
ApplicationType workspaceType) { ApplicationType appType) {
// create application instance // create application instance
// Whether a legacy compatible or a legacy free application is // Whether a legacy compatible or a legacy free application is
// created depends on the type of ApplicationType above. No need to // created depends on the type of ApplicationType above. No need to
// modify anything here in the migration process // modify anything here in the migration process
// old-style package key used as url fragment where to install the instance // old-style package key used as url fragment where to install the instance
s_log.debug("Creating CMS Workspace instance ..."); s_log.debug("Creating CMS ContentCenter instance ...");
Workspace app = (Workspace) Application.createApplication( ContentCenter app = (ContentCenter) Application.createApplication(
Workspace.BASE_DATA_OBJECT_TYPE, // type ContentCenter.BASE_DATA_OBJECT_TYPE, // type
Workspace.PACKAGE_KEY, // url fragment ContentCenter.PACKAGE_KEY, // url fragment
Workspace.INSTANCE_NAME, // title ContentCenter.INSTANCE_NAME, // title
null); // parent null); // parent
app.setDescription("The default CMS workspace instance."); app.setDescription("The default CMS ContentCenter instance.");
app.save(); app.save();
s_log.debug("CMS Workspace instance " + Workspace.PACKAGE_KEY + " created."); s_log.debug("CMS ContentCenter instance " + ContentCenter.PACKAGE_KEY
s_log.debug("Done loading CMS Workspace."); + " created.");
s_log.debug("Done loading CMS ContentCenter.");
} }
/** /**
@ -319,7 +319,8 @@ public class Loader extends PackageLoader {
ContentSectionConfig conf = new ContentSectionConfig(); ContentSectionConfig conf = new ContentSectionConfig();
conf.load(); conf.load();
ContentSectionSetup.setupContentSectionAppInstance(sectionName, ContentSectionSetup.setupContentSectionAppInstance(
sectionName,
conf.getDefaultRoles(), conf.getDefaultRoles(),
conf.getDefaultWorkflows(), conf.getDefaultWorkflows(),
s_conf.isPubliclyViewable(), s_conf.isPubliclyViewable(),
@ -327,7 +328,8 @@ public class Loader extends PackageLoader {
s_conf.getTemplateResolverClass(), s_conf.getTemplateResolverClass(),
m_content_type_list, m_content_type_list,
s_conf.getUseSectionCategories(), s_conf.getUseSectionCategories(),
s_conf.getCategoryFileList()); s_conf.getCategoryFileList()
);
} }

View File

@ -25,7 +25,6 @@ import com.arsdigita.cms.workflow.CMSEngine;
import com.arsdigita.cms.workflow.CMSTask; import com.arsdigita.cms.workflow.CMSTask;
import com.arsdigita.cms.workflow.CMSTaskType; import com.arsdigita.cms.workflow.CMSTaskType;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -185,7 +184,7 @@ public class SecurityManager implements Security, SecurityConstants {
public boolean canAccess(HttpServletRequest request, String action, public boolean canAccess(HttpServletRequest request, String action,
ContentItem item) { ContentItem item) {
User user = KernelHelper.getCurrentUser(request); User user = (User)Kernel.getContext().getParty();
boolean canAccess = canAccess(user, action, item); boolean canAccess = canAccess(user, action, item);
if (!canAccess) { if (!canAccess) {
canAccess = LocalRequestPassword.validLocalRequest(request); canAccess = LocalRequestPassword.validLocalRequest(request);
@ -498,7 +497,7 @@ public class SecurityManager implements Security, SecurityConstants {
HttpServletResponse response) HttpServletResponse response)
throws IOException, ServletException { throws IOException, ServletException {
if (KernelHelper.getCurrentUser(request) != null) { return; } if (Kernel.getContext().getParty() != null) { return; }
String url = com.arsdigita.kernel.security.Util String url = com.arsdigita.kernel.security.Util
.getSecurityHelper().getLoginURL(request) .getSecurityHelper().getLoginURL(request)
+ "?" + LoginHelper.RETURN_URL_PARAM_NAME + "?" + LoginHelper.RETURN_URL_PARAM_NAME

View File

@ -23,15 +23,10 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.publishToFile.LocalRequestPassword; import com.arsdigita.cms.publishToFile.LocalRequestPassword;
import com.arsdigita.developersupport.DeveloperSupport; import com.arsdigita.developersupport.DeveloperSupport;
import com.arsdigita.dispatcher.ChainedDispatcher; import com.arsdigita.dispatcher.*;
import com.arsdigita.dispatcher.Dispatcher;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.JSPApplicationDispatcher;
import com.arsdigita.dispatcher.RedirectException;
import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.ACSObjectCache; import com.arsdigita.kernel.ACSObjectCache;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.KernelContext;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.web.LoginSignal; import com.arsdigita.web.LoginSignal;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
@ -366,7 +361,7 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
RequestContext actx) RequestContext actx)
throws ServletException, AccessDeniedException { throws ServletException, AccessDeniedException {
User user = KernelHelper.getCurrentUser(request); User user = KernelContext.getUser();
ContentSection section = getContentSection(request); ContentSection section = getContentSection(request);
SecurityManager sm = getSecurityManager(section); SecurityManager sm = getSecurityManager(section);

View File

@ -34,7 +34,7 @@ import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelHelper; // import com.arsdigita.kernel.KernelContext;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PermissionService;
@ -116,7 +116,8 @@ public class CMSPage extends Page implements ResourceHandler {
* Builds the page. * Builds the page.
*/ */
protected void buildPage() { protected void buildPage() {
// Set the class attribute. // Set the class attribute value. May be overwritten by child class
// to hold a more specific value
setClassAttr(PAGE_CLASS); setClassAttr(PAGE_CLASS);
// Global XML params. // Global XML params.
@ -126,6 +127,8 @@ public class CMSPage extends Page implements ResourceHandler {
// MP: This is a hack to so that the XML params work with the newer // MP: This is a hack to so that the XML params work with the newer
// version of Xalan. // version of Xalan.
// Sets attribute in SimpleComponent, attributes of the same name will
// be overweritten.
setAttribute(ASSETS, Utilities.getGlobalAssetsURL()); setAttribute(ASSETS, Utilities.getGlobalAssetsURL());
// Make sure the error display gets rendered. // Make sure the error display gets rendered.
@ -327,10 +330,17 @@ public class CMSPage extends Page implements ResourceHandler {
} }
} }
/**
* Overwrites bebop.Page#generateXMLHelper to add the name of the user
* logged in to the page (displayed as part of the header).
* @param ps
* @param parent
* @return
*/
@Override @Override
protected Element generateXMLHelper(PageState ps, Document parent) { protected Element generateXMLHelper(PageState ps, Document parent) {
Element page = super.generateXMLHelper(ps,parent); Element page = super.generateXMLHelper(ps,parent);
User user = getCurrentUser(ps); User user = (User) Kernel.getContext().getParty();
if ( user != null ) { if ( user != null ) {
page.addAttribute("name",user.getDisplayName()); page.addAttribute("name",user.getDisplayName());
} }
@ -338,11 +348,11 @@ public class CMSPage extends Page implements ResourceHandler {
return page; return page;
} }
/** // /**
* @deprecated Use Kernel.getContext().getParty() if possible and // * @deprecated Use Kernel.getContext().getParty() if possible and
* Web.getContext().getUser() if necessary. // * Web.getContext().getUser() if necessary.
*/ // */
public static User getCurrentUser(PageState state) { // public static User getCurrentUser(PageState state) {
return KernelHelper.getCurrentUser(state.getRequest()); // return (User) Kernel.getContext().getParty();
} // }
} }

View File

@ -27,8 +27,9 @@ import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelContext; import com.arsdigita.kernel.KernelContext;
import com.arsdigita.kernel.KernelRequestContext;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.sitenode.SiteNodeRequestContext; // import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -64,7 +65,8 @@ public class ContentSectionDispatcher implements Dispatcher {
RequestContext context) RequestContext context)
throws IOException, ServletException { throws IOException, ServletException {
setContentSection(request, (SiteNodeRequestContext) context); // setContentSection(request, (SiteNodeRequestContext) context);
setContentSection(request, (KernelRequestContext) context);
dispatcherChain.dispatch(request, response, context); dispatcherChain.dispatch(request, response, context);
} }
@ -98,7 +100,8 @@ public class ContentSectionDispatcher implements Dispatcher {
* @return The current Content Section * @return The current Content Section
*/ */
private void setContentSection(HttpServletRequest request, private void setContentSection(HttpServletRequest request,
SiteNodeRequestContext actx) // SiteNodeRequestContext actx)
KernelRequestContext actx)
throws ServletException { throws ServletException {
try { try {

View File

@ -24,7 +24,7 @@ import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder; import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.LanguageUtil; import com.arsdigita.cms.util.LanguageUtil;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
@ -246,7 +246,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
// Determine if we are under the admin UI. // Determine if we are under the admin UI.
if (url.startsWith(ADMIN_PREFIX) || url.startsWith(Workspace.getURL())) { if (url.startsWith(ADMIN_PREFIX) || url.startsWith(ContentCenter.getURL())) {
return ContentItem.DRAFT; return ContentItem.DRAFT;
} else { } else {
return ContentItem.LIVE; return ContentItem.LIVE;

View File

@ -24,7 +24,7 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PermissionService;
@ -81,7 +81,7 @@ public abstract class ResourceHandlerImpl implements ResourceHandler {
HttpServletResponse response, HttpServletResponse response,
RequestContext actx, RequestContext actx,
ContentItem item) { ContentItem item) {
User user = KernelHelper.getCurrentUser(request); User user = (User)Kernel.getContext().getParty();
PrivilegeDescriptor view = PrivilegeDescriptor.get PrivilegeDescriptor view = PrivilegeDescriptor.get
(SecurityManager.CMS_READ_ITEM); (SecurityManager.CMS_READ_ITEM);

View File

@ -24,7 +24,7 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder; import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
@ -64,7 +64,7 @@ public class SimpleItemResolver extends AbstractItemResolver implements ItemReso
Logger.getLogger(SimpleItemResolver.class.getName()); Logger.getLogger(SimpleItemResolver.class.getName());
private static final String ADMIN_PREFIX = "admin"; private static final String ADMIN_PREFIX = "admin";
private static final String WORKSPACE_PREFIX = Workspace.getURL(); private static final String WORKSPACE_PREFIX = ContentCenter.getURL();
private static MasterPage s_masterP = null; private static MasterPage s_masterP = null;

View File

@ -25,8 +25,8 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Service; import com.arsdigita.cms.Service;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.WorkspaceServlet; import com.arsdigita.cms.ContentCenterServlet;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelContext; import com.arsdigita.kernel.KernelContext;
@ -62,13 +62,13 @@ public class Utilities {
public static final Logger LOG = Logger.getLogger(Utilities.class); public static final Logger LOG = Logger.getLogger(Utilities.class);
/** /**
* Fetch the location of the CMS Workspace package. * Fetch the location of the CMS ContentCenter package.
* @return The URL of the CMS Workspace package * @return The URL of the CMS ContentCenter package
* @deprecated use Workspace.getURL() instead * @deprecated use ContentCenter.getURL() instead
*/ */
public static String getWorkspaceURL() { public static String getWorkspaceURL() {
return Workspace.getURL(); return ContentCenter.getURL();
} }
@ -271,8 +271,8 @@ public class Utilities {
// OLD APPROACH: used in conjunction with CMSDispatcher. This // OLD APPROACH: used in conjunction with CMSDispatcher. This
// shouldn't do any harm even if CMSDispatcher is not being used. // shouldn't do any harm even if CMSDispatcher is not being used.
CMSDispatcher.releaseResource(section, "admin/item"); CMSDispatcher.releaseResource(section, "admin/item");
WorkspaceServlet.releaseResource(""); ContentCenterServlet.releaseResource("");
WorkspaceServlet.releaseResource("index"); ContentCenterServlet.releaseResource("index");
refreshAdminUI(state); refreshAdminUI(state);
// NEW APPROACH: used in conjunction with // NEW APPROACH: used in conjunction with
@ -296,8 +296,8 @@ public class Utilities {
CMSDispatcher.releaseResource(section, "admin"); CMSDispatcher.releaseResource(section, "admin");
CMSDispatcher.releaseResource(section, "admin/index"); CMSDispatcher.releaseResource(section, "admin/index");
CMSDispatcher.releaseResource(section, ""); CMSDispatcher.releaseResource(section, "");
WorkspaceServlet.releaseResource(""); ContentCenterServlet.releaseResource("");
WorkspaceServlet.releaseResource("index"); ContentCenterServlet.releaseResource("index");
} }
/** /**

View File

@ -31,11 +31,9 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionServlet; import com.arsdigita.cms.ContentSectionServlet;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.developersupport.DeveloperSupport; import com.arsdigita.developersupport.DeveloperSupport;
import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PermissionService;
@ -55,6 +53,16 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
// ////////////////////////////////////////////////////////////////////////////
//
// Currently under development as a replacement for CMSPage without the
// dispatcher mechanism but a new application style "pure" bebop page
// served by an application servlet.
//
// ////////////////////////////////////////////////////////////////////////////
/** /**
* <p>A <tt>CMSPage</tt> is a Bebop {@link com.arsdigita.bebop.Page} * <p>A <tt>CMSPage</tt> is a Bebop {@link com.arsdigita.bebop.Page}
* implementation of the {@link com.arsdigita.cms.dispatcher.ResourceHandler} * implementation of the {@link com.arsdigita.cms.dispatcher.ResourceHandler}
@ -329,8 +337,10 @@ public class CMSApplicationPage extends Page {
@Override @Override
protected Element generateXMLHelper(PageState ps, Document parent) { protected Element generateXMLHelper(PageState ps, Document parent) {
Element page = super.generateXMLHelper(ps,parent); Element page = super.generateXMLHelper(ps,parent);
User user = getCurrentUser(ps);
User user = (User) Kernel.getContext().getParty();
if ( user != null ) { if ( user != null ) {
page.addAttribute("name",user.getDisplayName()); page.addAttribute("name",user.getDisplayName());
} }
@ -338,11 +348,4 @@ public class CMSApplicationPage extends Page {
return page; return page;
} }
/**
* @deprecated Use Kernel.getContext().getParty() if possible and
* Web.getContext().getUser() if necessary.
*/
public static User getCurrentUser(PageState state) {
return KernelHelper.getCurrentUser(state.getRequest());
}
} }

View File

@ -20,29 +20,26 @@ package com.arsdigita.cms.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.TabbedPane; import com.arsdigita.bebop.TabbedPane;
import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener; import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.ui.workspace.TasksPanel; import com.arsdigita.cms.ui.contentcenter.TasksPanel;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
import com.arsdigita.ui.DebugPanel; import com.arsdigita.ui.DebugPanel;
/** /**
* <p>The Content Center page.</p> * <p>The Content Center main page (index page). </p>
*
* This class uses the dispatcher based page creation mechanism.
* *
* @author Jack Chung (flattop@arsdigita.com) * @author Jack Chung (flattop@arsdigita.com)
* @author Michael Pih (pihman@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com)
@ -66,6 +63,9 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
* Construct a new CMSPageWorkspacePage * Construct a new CMSPageWorkspacePage
*/ */
public CMSPageWorkspacePage() { // Constructor Page public CMSPageWorkspacePage() { // Constructor Page
/* specifically invokes PresentationManager / PageTransformer to create
* a page instantiation. */
super(new Label( GlobalizationUtil.globalize super(new Label( GlobalizationUtil.globalize
("cms.ui.content_center")), ("cms.ui.content_center")),
new SimpleContainer()); new SimpleContainer());
@ -74,11 +74,11 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE); BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE);
addGlobalStateParam(typeId); addGlobalStateParam(typeId);
m_typeSel = new ACSObjectSelectionModel m_typeSel = new ACSObjectSelectionModel(ContentType.class.getName(),
(ContentType.class.getName(), ContentType.BASE_DATA_OBJECT_TYPE, typeId); ContentType.BASE_DATA_OBJECT_TYPE,
typeId);
BigDecimalParameter sectionId = new BigDecimalParameter BigDecimalParameter sectionId = new BigDecimalParameter(CONTENT_SECTION);
(CONTENT_SECTION);
addGlobalStateParam(sectionId); addGlobalStateParam(sectionId);
m_sectionSel = new ACSObjectSelectionModel m_sectionSel = new ACSObjectSelectionModel
(ContentSection.class.getName(), (ContentSection.class.getName(),
@ -101,7 +101,7 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
/** /**
* Creates, and then caches, the Tasks pane. Overriding this * Creates, and then caches, the Tasks pane. Overriding this
* method to return null will prevent this tab from appearing. * method to return null will prevent this tab from appearing.
**/ */
protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel, protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel,
ACSObjectSelectionModel sectionModel) { ACSObjectSelectionModel sectionModel) {
if (m_tasks == null) { if (m_tasks == null) {
@ -122,7 +122,7 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
return m_search; return m_search;
} }
/*
private SimpleContainer makeHeader() { private SimpleContainer makeHeader() {
PrintListener l = new PrintListener() { PrintListener l = new PrintListener() {
public void prepare(PrintEvent event) { public void prepare(PrintEvent event) {
@ -145,21 +145,22 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
return sc; return sc;
} }
*/
/** /**
* Created the TabbedPane to use for this page. Sets the class * Created the TabbedPane to use for this page.
* attribute for this tabbed pane. The default implementation uses a *
* {@link com.arsdigita.bebop.TabbedPane} and sets the class * This is the "index" page, displayed at the base address (content-center
* by default).
*
* Sets the class attribute for this tabbed pane. The default implementation
* uses a {@link com.arsdigita.bebop.TabbedPane} and sets the class
* attribute to "CMS Admin." This implementation also adds tasks, * attribute to "CMS Admin." This implementation also adds tasks,
* content sections, and search panes. * content sections, and search panes.
* *
*<p> * Developers can override this method to add only the tabs they want,
* * or to add additional tabs after the default CMS tabs are added.
* Developers can override this method to add only the tabs they */
* want, or to add additional tabs after the default CMS tabs are
* added.
**/
protected TabbedPane createTabbedPane() { protected TabbedPane createTabbedPane() {
TabbedPane pane = new TabbedPane(); TabbedPane pane = new TabbedPane();
pane.setClassAttr(XSL_CLASS); pane.setClassAttr(XSL_CLASS);

View File

@ -25,7 +25,7 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.PageLocations; import com.arsdigita.cms.PageLocations;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
@ -63,7 +63,7 @@ public class ContentItemNavbar extends CMSContainer {
ContentType type = item.getContentType(); ContentType type = item.getContentType();
final String url = URL.there(state.getRequest(), final String url = URL.there(state.getRequest(),
Workspace.getURL()).toString(); ContentCenter.getURL()).toString();
element.addAttribute("workspaceURL", url); element.addAttribute("workspaceURL", url);
element.addAttribute("sectionName", section.getName()); element.addAttribute("sectionName", section.getName());

View File

@ -47,8 +47,13 @@ class ContentSectionContextBar extends WorkspaceContextBar {
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger
(ContentSectionContextBar.class); (ContentSectionContextBar.class);
@Override
protected List entries(final PageState state) { protected List entries(final PageState state) {
/* Include breadcrumb entries already set by content-center (i.e. the
* URL of the content center itself */
final List entries = super.entries(state); final List entries = super.entries(state);
final ContentSection section = CMS.getContext().getContentSection(); final ContentSection section = CMS.getContext().getContentSection();
final Stack folderEntryStack = new Stack(); final Stack folderEntryStack = new Stack();
String currentFolderLabel = null; String currentFolderLabel = null;

View File

@ -24,7 +24,7 @@ import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.ui.UI; import com.arsdigita.ui.UI;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
@ -45,7 +45,7 @@ public class ContentSectionNavbar extends CMSContainer {
setClassAttr("section"); setClassAttr("section");
String wsUrl = UI.getWorkspaceURL(); String wsUrl = UI.getWorkspaceURL();
String csUrl = Workspace.getURL(); String csUrl = ContentCenter.getURL();
m_navbar = new DimensionalNavbar(); m_navbar = new DimensionalNavbar();
m_navbar.setAlign(DimensionalNavbar.LEFT); m_navbar.setAlign(DimensionalNavbar.LEFT);

View File

@ -58,7 +58,7 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.ObjectPermissionCollection; import com.arsdigita.kernel.permissions.ObjectPermissionCollection;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -344,7 +344,7 @@ public class FlatItemList extends SegmentedPanel
m_editFolderAction.setVisible(state, editItem); m_editFolderAction.setVisible(state, editItem);
User user = KernelHelper.getCurrentUser(state.getRequest()); User user = (User) Kernel.getContext().getParty();
PermissionDescriptor perm = PermissionDescriptor perm =
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
folder, folder,

View File

@ -21,7 +21,7 @@ package com.arsdigita.cms.ui;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleComponent; import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.ui.UI; import com.arsdigita.ui.UI;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
@ -35,7 +35,8 @@ import javax.servlet.http.HttpServletRequest;
* @author Justin Ross &lt;jross@redhat.com&gt; * @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: GlobalNavigation.java 1942 2009-05-29 07:53:23Z terry $ * @version $Id: GlobalNavigation.java 1942 2009-05-29 07:53:23Z terry $
*/ */
class GlobalNavigation extends SimpleComponent { // Made public (instead of unspecified, resulting in protected) in 6.6.8
public class GlobalNavigation extends SimpleComponent {
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger
(GlobalNavigation.class); (GlobalNavigation.class);
@ -45,13 +46,21 @@ class GlobalNavigation extends SimpleComponent {
private final String m_signOutPath; private final String m_signOutPath;
private final String m_helpPath; private final String m_helpPath;
GlobalNavigation() { /**
m_centerPath = Workspace.getURL(); *
*/
public GlobalNavigation() {
m_centerPath = ContentCenter.getURL();
m_wspcPath = UI.getWorkspaceURL(); m_wspcPath = UI.getWorkspaceURL();
m_signOutPath = UI.getLogoutPageURL(); m_signOutPath = UI.getLogoutPageURL();
m_helpPath = "/nowhere"; // We don't have this yet XXX. m_helpPath = "/nowhere"; // We don't have this yet XXX.
} }
/**
*
* @param state
* @param parent
*/
@Override @Override
public void generateXML(final PageState state, final Element parent) { public void generateXML(final PageState state, final Element parent) {
if (isVisible(state)) { if (isVisible(state)) {
@ -72,6 +81,15 @@ class GlobalNavigation extends SimpleComponent {
} }
} }
/**
*
* @param sreq
* @param parent
* @param name
* @param path
* @param title
* @return
*/
private static Element link(final HttpServletRequest sreq, private static Element link(final HttpServletRequest sreq,
final Element parent, final Element parent,
final String name, final String name,
@ -85,6 +103,11 @@ class GlobalNavigation extends SimpleComponent {
return link; return link;
} }
/**
*
* @param key
* @return
*/
private static String lz(final String key) { private static String lz(final String key) {
return (String) ContentSectionPage.globalize(key).localize(); return (String) ContentSectionPage.globalize(key).localize();
} }

View File

@ -28,25 +28,21 @@ import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.BooleanParameter; import com.arsdigita.bebop.parameters.BooleanParameter;
import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.CMSConfig; import com.arsdigita.cms.*;
import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Folder;
import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.OID;
import com.arsdigita.templating.PresentationManager; import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating; import com.arsdigita.templating.Templating;
import com.arsdigita.toolbox.ui.OIDParameter;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.xml.Document;
import com.arsdigita.web.Web;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Document;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -184,20 +180,13 @@ public class ItemSearchPage extends CMSPage {
// } // }
// //
// }); // });
} } // END constructor
// private void enableCreatePane(final PageState state) {
// final BigDecimal typeParam = (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
// if (typeParam == null) {
// m_tabbedPane.setTabVisible(state, m_create, false);
// m_create.setVisible(state, false);
// } else {
// m_tabbedPane.setTabVisible(state, m_create, true);
// m_create.setVisible(state, true);
// }
// }
/** /**
* Creates, and then caches, the Browse pane. Overriding this method to return null will prevent this tab from * Creates, and then caches, the Browse pane.
*
* Overriding this method to return null will prevent this tab from
* appearing. Note: not implemented yet. * appearing. Note: not implemented yet.
*/ */
protected ItemSearchBrowsePane getBrowsePane() { protected ItemSearchBrowsePane getBrowsePane() {
@ -217,7 +206,8 @@ public class ItemSearchPage extends CMSPage {
} }
/** /**
* Creates, and then caches, the Creation pane. Overriding this method to return null will prevent this tab from * Creates, and then caches, the Creation pane.
* Overriding this method to return null will prevent this tab from
* appearing. * appearing.
*/ */
protected ItemSearchPopup getSearchPane() { protected ItemSearchPopup getSearchPane() {
@ -239,13 +229,15 @@ public class ItemSearchPage extends CMSPage {
} }
/** /**
* Created the TabbedPane to use for this page. Sets the class attribute for this tabbed pane. The default * Created the TabbedPane to use for this page.
* implementation uses a
* {@link com.arsdigita.bebop.TabbedPane} and sets the class attribute to "CMS Admin." This implementation also adds
* tasks, content sections, and search panes.
* *
* Developers can override this method to add only the tabs they want, or to add additional tabs after the default * Sets the class attribute for this tabbed pane. The default implementation
* CMS tabs are added. * uses a {@link com.arsdigita.bebop.TabbedPane} and sets the class
* attribute to "CMS Admin." This implementation also adds tasks,
* content sections, and search panes.
*
* Developers can override this method to add only the tabs they want,
* or to add additional tabs after the default CMS tabs are added.
*/ */
protected TabbedPane createTabbedPane() { protected TabbedPane createTabbedPane() {
TabbedPane pane = new TabbedPane(); TabbedPane pane = new TabbedPane();
@ -271,7 +263,8 @@ public class ItemSearchPage extends CMSPage {
} }
/** /**
* Adds the specified component, with the specified tab name, to the tabbed pane only if it is not null. * Adds the specified component, with the specified tab name, to the
* tabbed pane only if it is not null.
* *
* @param pane The pane to which to add the tab * @param pane The pane to which to add the tab
* @param tabName The name of the tab if it's added * @param tabName The name of the tab if it's added
@ -279,24 +272,16 @@ public class ItemSearchPage extends CMSPage {
*/ */
protected void addToPane(TabbedPane pane, String tabName, Component comp) { protected void addToPane(TabbedPane pane, String tabName, Component comp) {
if (comp != null) { if (comp != null) {
pane.addTab(GlobalizationUtil.globalize("cms.ui.item_search." + tabName).localize().toString(), comp);
pane.addTab(GlobalizationUtil
.globalize("cms.ui.item_search." + tabName)
.localize().toString()
,comp);
} }
} }
/**
* When a new tab is selected, reset the state of the formerly-selected pane.
*
* @param event The event fired by selecting a tab
*/
//public void actionPerformed(ActionEvent event) {
//PageState state = event.getPageState();
//Component pane = m_tabbedPane.getCurrentPane(state);
//if ( pane == m_browse ) {
// MP: reset tasks pane
//} else if ( pane == m_search ) {
//m_search.reset(state);
//}
//}
/** /**
* This strange voodoo from Dan. No idea what it does. * This strange voodoo from Dan. No idea what it does.
*/ */

View File

@ -42,8 +42,8 @@ import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentTypeLifecycleDefinition; import com.arsdigita.cms.ContentTypeLifecycleDefinition;
import com.arsdigita.cms.Folder; import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.WorkspaceServlet; import com.arsdigita.cms.ContentCenterServlet;
import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
@ -284,11 +284,11 @@ public class ItemSearchWidget extends FormSection
params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString()); params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString());
} }
String searchURL = WorkspaceServlet.getURLStubForClass( String searchURL = ContentCenterServlet.getURLStubForClass(
ItemSearchPage.class.getName()); ItemSearchPage.class.getName());
s_log.debug("Search URL stub is: " + searchURL); s_log.debug("Search URL stub is: " + searchURL);
searchURL = Workspace.getURL() + searchURL; searchURL = ContentCenter.getURL() + searchURL;
// TODO Not sure what to do when you get a null here // TODO Not sure what to do when you get a null here

View File

@ -48,7 +48,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SectionLocaleCollection; import com.arsdigita.cms.SectionLocaleCollection;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
@ -182,7 +182,7 @@ public class SectionConfigurationPage extends CMSPage implements Resettable {
DimensionalNavbar dn = new DimensionalNavbar(); DimensionalNavbar dn = new DimensionalNavbar();
dn.setDelimiter(" - "); dn.setDelimiter(" - ");
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.my_workspace")), Workspace.getURL())); dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.my_workspace")), ContentCenter.getURL()));
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.sign_out")), Utilities.getLogoutURL())); dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.sign_out")), Utilities.getLogoutURL()));
// FIXME: Write online help, for the time being, do not offer a link // FIXME: Write online help, for the time being, do not offer a link
// dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.help")), "help")); // dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.help")), "help"));

View File

@ -19,9 +19,10 @@
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.toolbox.ui.ContextBar; import com.arsdigita.toolbox.ui.ContextBar;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.util.List; import java.util.List;
@ -32,17 +33,29 @@ import java.util.List;
* @author Justin Ross &lt;jross@redhat.com&gt; * @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: WorkspaceContextBar.java 2286 2012-03-11 09:14:14Z pboy $ * @version $Id: WorkspaceContextBar.java 2286 2012-03-11 09:14:14Z pboy $
*/ */
class WorkspaceContextBar extends ContextBar { // Made public (instead of unspecified) in 6.6.8
public class WorkspaceContextBar extends ContextBar {
/** A logger instance, primarily to assist debugging . */
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger
(WorkspaceContextBar.class); (WorkspaceContextBar.class);
/**
*
* @param state
* @return
*/
@Override @Override
protected List entries(final PageState state) { protected List entries(final PageState state) {
final List entries = super.entries(state); final List entries = super.entries(state);
final String centerTitle = lz("cms.ui.content_center"); final String centerTitle = lz("cms.ui.content_center");
final String centerPath = Workspace.getURL(); // final String centerPath = ContentCenter.getURL();
final String centerPath = ContentCenter.getURL();
if (s_log.isDebugEnabled()) {
s_log.debug("Got Url: " + centerPath);
}
final URL url = URL.there(state.getRequest(), centerPath); final URL url = URL.there(state.getRequest(), centerPath);
entries.add(new Entry(centerTitle, url)); entries.add(new Entry(centerTitle, url));

View File

@ -19,13 +19,7 @@
package com.arsdigita.cms.ui.category; package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.*;
import com.arsdigita.bebop.Grid;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.categorization.Category; import com.arsdigita.categorization.Category;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
@ -38,7 +32,7 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
@ -135,7 +129,7 @@ public class CategoryItemsBrowser extends Grid {
Category cat = (Category)m_sel.getSelectedObject(s); Category cat = (Category)m_sel.getSelectedObject(s);
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
User user = KernelHelper.getCurrentUser( s.getRequest() ); User user = (User)Kernel.getContext().getParty();
OID oid = null; OID oid = null;
if (user != null) { if (user != null) {
oid = user.getOID(); oid = user.getOID();

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.ui.workspace; package com.arsdigita.cms.ui.contentcenter;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@ -1,5 +1,4 @@
/* /*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -16,39 +15,43 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui.contentcenter;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.*;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.TabbedPane;
import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener; import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.ui.GlobalNavigation;
import com.arsdigita.cms.ui.workspace.TasksPanel; import com.arsdigita.cms.ui.ItemSearch;
import com.arsdigita.cms.ui.WorkspaceContextBar;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
import com.arsdigita.ui.DebugPanel; import com.arsdigita.ui.DebugPanel;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Document;
import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
/** /**
* <p>The Content Center page.</p> * <p>The Content Center main page. </p>
*
* The page contains the general header and footer, the breadcrumb, and the
* complete content page including the tab bar, the sections/tasks page, the
* search page, and the listener to switch between the tabs.
* *
* @author Jack Chung (flattop@arsdigita.com) * @author Jack Chung (flattop@arsdigita.com)
* @author Michael Pih (pihman@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com)
* @version $Id: WorkspacePage.java 2280 2012-03-10 23:55:04Z pboy $ * @author Peter Boy (pboy@barkhof.uni-bremen.de)
* @version $Id: MainPage.java pboy $
*/ */
public class WorkspacePage extends CMSPage implements ActionListener { public class MainPage extends Page implements ActionListener {
private static final Logger s_log = Logger.getLogger(MainPage.class);
private final static String XSL_CLASS = "CMS Admin"; private final static String XSL_CLASS = "CMS Admin";
@ -63,27 +66,35 @@ public class WorkspacePage extends CMSPage implements ActionListener {
public static final String CONTENT_SECTION = "section_id"; public static final String CONTENT_SECTION = "section_id";
/** /**
* Construct a new CMSPageWorkspacePage * Construct a new MainPage.
*
* Creates the complete page ready to be included in the page cache of
* ContentCenterServlet.
*/ */
public WorkspacePage() { // Constructor Page public MainPage() {
super(new Label( GlobalizationUtil.globalize super(new Label( GlobalizationUtil.globalize
("cms.ui.content_center")), ("cms.ui.content_center")),
new SimpleContainer()); new SimpleContainer());
/* Set the class attribute value (down in SimpleComponent). */
setClassAttr("cms-admin"); setClassAttr("cms-admin");
BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE); BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE);
addGlobalStateParam(typeId); addGlobalStateParam(typeId);
m_typeSel = new ACSObjectSelectionModel m_typeSel = new ACSObjectSelectionModel(
(ContentType.class.getName(), ContentType.BASE_DATA_OBJECT_TYPE, typeId); ContentType.class.getName(),
ContentType.BASE_DATA_OBJECT_TYPE,
typeId
);
BigDecimalParameter sectionId = new BigDecimalParameter BigDecimalParameter sectionId = new BigDecimalParameter(CONTENT_SECTION);
(CONTENT_SECTION);
addGlobalStateParam(sectionId); addGlobalStateParam(sectionId);
m_sectionSel = new ACSObjectSelectionModel m_sectionSel = new ACSObjectSelectionModel(
(ContentSection.class.getName(), ContentSection.class.getName(),
ContentSection.BASE_DATA_OBJECT_TYPE, ContentSection.BASE_DATA_OBJECT_TYPE,
sectionId); sectionId
);
add( new WorkspaceContextBar() ); add( new WorkspaceContextBar() );
add( new GlobalNavigation() ); add( new GlobalNavigation() );
@ -96,12 +107,15 @@ public class WorkspacePage extends CMSPage implements ActionListener {
add(m_tabbedPane); add(m_tabbedPane);
add(new DebugPanel()); add(new DebugPanel());
/* Page complete, locked now. */
lock();
} }
/** /**
* Creates, and then caches, the Tasks pane. Overriding this * Creates, and then caches, the Tasks pane. Overriding this
* method to return null will prevent this tab from appearing. * method to return null will prevent this tab from appearing.
**/ */
protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel, protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel,
ACSObjectSelectionModel sectionModel) { ACSObjectSelectionModel sectionModel) {
if (m_tasks == null) { if (m_tasks == null) {
@ -122,7 +136,7 @@ public class WorkspacePage extends CMSPage implements ActionListener {
return m_search; return m_search;
} }
/*
private SimpleContainer makeHeader() { private SimpleContainer makeHeader() {
PrintListener l = new PrintListener() { PrintListener l = new PrintListener() {
public void prepare(PrintEvent event) { public void prepare(PrintEvent event) {
@ -145,7 +159,7 @@ public class WorkspacePage extends CMSPage implements ActionListener {
return sc; return sc;
} }
*/
/** /**
* Created the TabbedPane to use for this page. Sets the class * Created the TabbedPane to use for this page. Sets the class
@ -201,4 +215,32 @@ public class WorkspacePage extends CMSPage implements ActionListener {
m_search.reset(state); m_search.reset(state);
} }
} }
/**
* Overwrites bebop.Page#generateXMLHelper to add the name of the user
* logged in to the page (displayed as part of the header).
* @param ps
* @param parent
* @return
*/
// ToDo: This code fragment is used by several pages of CMS package. It
// should be factored out into a kind of CMSBasePage, as it had been in
// the deprecated CMSPage.
// Should be checked when refactoring the content section pages to work
// as bebop pages without dispatcher mechanism and in new style application.
@Override
protected Element generateXMLHelper(PageState ps, Document parent) {
/* Retain elements already included. */
Element page = super.generateXMLHelper(ps,parent);
/* Add name of user logged in. */
User user = Web.getContext().getUser();
if ( user != null ) {
page.addAttribute("name",user.getDisplayName());
}
return page;
}
} }

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.ui.workspace; package com.arsdigita.cms.ui.contentcenter;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@ -18,25 +18,8 @@
*/ */
package com.arsdigita.cms.ui.folder; package com.arsdigita.cms.ui.folder;
import com.arsdigita.bebop.ActionLink; import com.arsdigita.bebop.*;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.event.*;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.Resettable;
import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.ChangeEvent;
import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
@ -49,7 +32,7 @@ import com.arsdigita.cms.ui.permissions.CMSPermissionsPane;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.ObjectPermissionCollection; import com.arsdigita.kernel.permissions.ObjectPermissionCollection;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -62,6 +45,7 @@ import com.arsdigita.toolbox.ui.ActionGroup;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -314,7 +298,7 @@ public class FolderItemPane extends SegmentedPanel
m_editFolderAction.setVisible(state, editItem); m_editFolderAction.setVisible(state, editItem);
User user = KernelHelper.getCurrentUser(state.getRequest()); User user = (User)Kernel.getContext().getParty();
PermissionDescriptor perm = PermissionDescriptor perm =
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
folder, folder,

View File

@ -42,7 +42,7 @@ import com.arsdigita.cms.ui.authoring.LanguageWidget;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.cms.util.LanguageUtil; import com.arsdigita.cms.util.LanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.toolbox.ui.ActionGroup; import com.arsdigita.toolbox.ui.ActionGroup;
import com.arsdigita.toolbox.ui.LayoutPanel; import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.toolbox.ui.Section; import com.arsdigita.toolbox.ui.Section;
@ -167,7 +167,7 @@ public class ItemLanguages extends LayoutPanel {
if ( template != null ) { if ( template != null ) {
Workflow w = template.instantiateNewWorkflow(); Workflow w = template.instantiateNewWorkflow();
w.setObjectID(item.getID()); w.setObjectID(item.getID());
w.start(KernelHelper.getCurrentUser(state.getRequest())); w.start(Kernel.getContext().getUser());
w.save(); w.save();
} }

View File

@ -49,7 +49,7 @@ import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.lifecycle.Lifecycle; import com.arsdigita.cms.lifecycle.Lifecycle;
import com.arsdigita.cms.ui.BaseItemPane; import com.arsdigita.cms.ui.BaseItemPane;
@ -370,7 +370,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) { if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal( throw new RedirectSignal(
URL.there(state.getRequest(), URL.there(state.getRequest(),
Workspace.getURL()), true); ContentCenter.getURL()), true);
} }
} }
} }
@ -507,7 +507,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) { if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal( throw new RedirectSignal(
URL.there(state.getRequest(), URL.there(state.getRequest(),
Workspace.getURL()), true); ContentCenter.getURL()), true);
} }
} }
} }
@ -726,7 +726,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) { if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal( throw new RedirectSignal(
URL.there(state.getRequest(), URL.there(state.getRequest(),
Workspace.getURL()), true); ContentCenter.getURL()), true);
} }
} }
} else if (REPUBLISH_AND_RESET.equals(selected)) { } else if (REPUBLISH_AND_RESET.equals(selected)) {
@ -812,7 +812,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
if (ContentSection.getConfig().getUseStreamlinedCreation()) { if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal( throw new RedirectSignal(
URL.there(state.getRequest(), URL.there(state.getRequest(),
Workspace.getURL()), true); ContentCenter.getURL()), true);
} }
} }
} else if (UNPUBLISH.equals(selected)) { } else if (UNPUBLISH.equals(selected)) {

View File

@ -43,7 +43,7 @@ import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentTypeLifecycleDefinition; import com.arsdigita.cms.ContentTypeLifecycleDefinition;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.lifecycle.Lifecycle; import com.arsdigita.cms.lifecycle.Lifecycle;
import com.arsdigita.cms.lifecycle.LifecycleDefinition; import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection; import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
@ -468,7 +468,7 @@ class ItemLifecycleSelectForm extends BaseForm {
if (ContentSection.getConfig().getUseStreamlinedCreation()) { if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal( throw new RedirectSignal(
URL.there(state.getRequest(), URL.there(state.getRequest(),
Workspace.getURL()), ContentCenter.getURL()),
true); true);
} }
} }

View File

@ -41,7 +41,7 @@ import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -389,7 +389,7 @@ public class CMSPermissionsPane extends SimpleContainer
// Now check for object admin // Now check for object admin
if (!canAccess) { if (!canAccess) {
User user = KernelHelper.getCurrentUser(); User user = (User)Kernel.getContext().getParty();
PermissionDescriptor perm = PermissionDescriptor perm =
new PermissionDescriptor(PrivilegeDescriptor.ADMIN, new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
object, user); object, user);

View File

@ -23,7 +23,7 @@ import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.portal.AbstractPortletRenderer; import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.portlet.TaskPortlet; import com.arsdigita.cms.portlet.TaskPortlet;
import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
@ -63,7 +63,7 @@ public class TaskPortletRenderer extends AbstractPortletRenderer {
protected void generateBodyXML(PageState pageState, Element parentElement) { protected void generateBodyXML(PageState pageState, Element parentElement) {
final String contentCenter = Workspace.getURL(); final String contentCenter = ContentCenter.getURL();
Link link = new Link("Content Center", contentCenter); Link link = new Link("Content Center", contentCenter);

View File

@ -30,7 +30,7 @@ import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.RadioGroup; import com.arsdigita.bebop.form.RadioGroup;
import com.arsdigita.bebop.parameters.BooleanParameter; import com.arsdigita.bebop.parameters.BooleanParameter;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.Workspace; import com.arsdigita.cms.ContentCenter;
import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.workflow.CMSEngine; import com.arsdigita.cms.workflow.CMSEngine;
import com.arsdigita.cms.workflow.CMSTask; import com.arsdigita.cms.workflow.CMSTask;
@ -205,7 +205,7 @@ public final class TaskFinishForm extends CommentAddForm {
if (ContentSection.getConfig().getUseStreamlinedCreation()) { if (ContentSection.getConfig().getUseStreamlinedCreation()) {
throw new RedirectSignal throw new RedirectSignal
(URL.there(state.getRequest(), (URL.there(state.getRequest(),
Workspace.getURL()), ContentCenter.getURL()),
true); true);
} }

View File

@ -91,7 +91,7 @@ public class AddNewStyleApplicationEntries extends Program {
// Update CMS Workspace // Update CMS Workspace
ApplicationType appType = null; ApplicationType appType = null;
appType = Loader.loadWorkspaceApplicationType(); appType = Loader.loadContentCenterApplicationType();
// get corresponding package type // get corresponding package type
PackageType packageType = PackageType.findByKey("content-center"); PackageType packageType = PackageType.findByKey("content-center");
// get all installed instances // get all installed instances

View File

@ -20,27 +20,16 @@ package com.arsdigita.cms.workflow;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
// import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.ui.ContentItemPage; import com.arsdigita.cms.ui.ContentItemPage;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.kernel.Group; import com.arsdigita.kernel.*;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.UserCollection;
import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.messaging.Message; import com.arsdigita.messaging.Message;
import com.arsdigita.notification.Notification; import com.arsdigita.notification.Notification;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.*;
import com.arsdigita.persistence.DataOperation;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.Filter;
import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.metadata.ObjectType; import com.arsdigita.persistence.metadata.ObjectType;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.versioning.TagCollection; import com.arsdigita.versioning.TagCollection;
@ -48,19 +37,13 @@ import com.arsdigita.versioning.Transaction;
import com.arsdigita.versioning.TransactionCollection; import com.arsdigita.versioning.TransactionCollection;
import com.arsdigita.versioning.Versions; import com.arsdigita.versioning.Versions;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
import com.arsdigita.web.Web;
import com.arsdigita.workflow.simple.TaskComment; import com.arsdigita.workflow.simple.TaskComment;
import com.arsdigita.workflow.simple.TaskException; import com.arsdigita.workflow.simple.TaskException;
import com.arsdigita.workflow.simple.UserTask; import com.arsdigita.workflow.simple.UserTask;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -290,8 +273,8 @@ public class CMSTask extends UserTask {
g11nArgs[0] = item.getDisplayName(); g11nArgs[0] = item.getDisplayName();
g11nArgs[1] = new Double(getTaskType().getID().doubleValue()); g11nArgs[1] = new Double(getTaskType().getID().doubleValue());
g11nArgs[2] = fullURL; g11nArgs[2] = fullURL;
g11nArgs[3] = KernelHelper.getSiteName(); g11nArgs[3] = Web.getConfig().getSiteName();
g11nArgs[4] = KernelHelper.getSystemAdministratorEmailAddress(); g11nArgs[4] = Kernel.getSecurityConfig().getAdminContactEmail();
g11nArgs[5] = new Date(); g11nArgs[5] = new Date();
TaskComment comment = getLastCommentInWorkflow(); TaskComment comment = getLastCommentInWorkflow();
User commenter = null; User commenter = null;

View File

@ -8,6 +8,7 @@
<jsp:directive.page import="com.arsdigita.cms.ContentSectionCollection"/> <jsp:directive.page import="com.arsdigita.cms.ContentSectionCollection"/>
<jsp:directive.page import="com.arsdigita.cms.SecurityManager"/> <jsp:directive.page import="com.arsdigita.cms.SecurityManager"/>
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/> <jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
<jsp:directive.page import="com.arsdigita.cms.Workspace"/>
<jsp:scriptlet> <jsp:scriptlet>
ContentSectionCollection sections = ContentSection.getAllSections(); ContentSectionCollection sections = ContentSection.getAllSections();
@ -24,7 +25,8 @@
String url; String url;
if (hasAccess) { if (hasAccess) {
url = Utilities.getWorkspaceURL(); // url = Utilities.getWorkspaceURL();
url = Workspace.getURL();
} else { } else {
url = UI.getWorkspaceURL(request); url = UI.getWorkspaceURL(request);
} }

View File

@ -48,7 +48,7 @@ import java.lang.reflect.InvocationTargetException;
* *
* <ol> * <ol>
* <li>It is common for all pages on a site to have a particular * <li>It is common for all pages on a site to have a particular
* structure. ie, header, footer, left sidebar & main content * area. </li> * structure. ie, header, footer, left sidebar & main content area. </li>
* *
* <li>It is desirable to customize page structure without making code changes * <li>It is desirable to customize page structure without making code changes
* to individual applications. </li> * to individual applications. </li>
@ -83,7 +83,7 @@ import java.lang.reflect.InvocationTargetException;
* import com.arsdigita.simplesurvey.ui.AdminPanel; * import com.arsdigita.simplesurvey.ui.AdminPanel;
* import com.arsdigita.simplesurvey.ui.SurveySelectionModel; * import com.arsdigita.simplesurvey.ui.SurveySelectionModel;
* import com.arsdigita.bebop.BigDecimalParameter; * import com.arsdigita.bebop.BigDecimalParameter;
* import com.arsdigita.bebop.BebopMapDispatcher; * import com.arsdigita.bebop.page.BebopMapDispatcher;
* *
* public class Dispatcher extends BebopMapDispatcher { * public class Dispatcher extends BebopMapDispatcher {
* *

View File

@ -301,6 +301,8 @@ public class Loader extends PackageLoader {
s_log.debug("CoreLoader: Going to execute loadHost()."); s_log.debug("CoreLoader: Going to execute loadHost().");
loadHost(); loadHost();
// Note: Loading of Subsite is currently required by Login
// module otherwise Login doesn't work!
s_log.debug("CoreLoader: Going to execute loadSubsite()."); s_log.debug("CoreLoader: Going to execute loadSubsite().");
loadSubsite(loadKernel()); loadSubsite(loadKernel());
@ -360,6 +362,9 @@ public class Loader extends PackageLoader {
} }
/** /**
* .
* Note: Loading of Subsite is currently required by Login
* module otherwise Login doesn't work!
* *
* @param rootNode * @param rootNode
* @deprecated will be removed without replacement. Naot needed anymore * @deprecated will be removed without replacement. Naot needed anymore

View File

@ -543,7 +543,7 @@ public final class DispatcherHelper implements DispatcherConstants {
* @param resp the current response * @param resp the current response
* @param url the destination URL for redirect * @param url the destination URL for redirect
**/ **/
public static void sendRedirect(HttpServletResponse resp, public static void sendRedirect( HttpServletResponse resp,
String url) String url)
throws IOException { throws IOException {
sendExternalRedirect(resp, url); sendExternalRedirect(resp, url);
@ -572,8 +572,8 @@ public final class DispatcherHelper implements DispatcherConstants {
* @param resp the current response * @param resp the current response
* @param url the destination URL for redirect * @param url the destination URL for redirect
**/ **/
public static void sendExternalRedirect(HttpServletResponse resp, public static void sendExternalRedirect( HttpServletResponse resp,
String url) String url )
throws IOException { throws IOException {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Redirecting to URL '" + url + "'", new Throwable()); s_log.debug("Redirecting to URL '" + url + "'", new Throwable());
@ -1091,7 +1091,8 @@ public final class DispatcherHelper implements DispatcherConstants {
public static Locale getNegotiatedLocale() { public static Locale getNegotiatedLocale() {
KernelConfig kernelConfig = Kernel.getConfig(); KernelConfig kernelConfig = Kernel.getConfig();
// Set the preferedLocale to the default locale (first entry in the config parameter list) // Set the preferedLocale to the default locale (first entry in the
// config parameter list)
Locale preferedLocale = new Locale(kernelConfig.getDefaultLanguage(), "", ""); Locale preferedLocale = new Locale(kernelConfig.getDefaultLanguage(), "", "");
// The ACCEPTED_LANGUAGES from the client // The ACCEPTED_LANGUAGES from the client

View File

@ -398,14 +398,15 @@ public abstract class ACSObject extends ObservableDomainObject {
* @throws PermissionException if the user does not have the privilege * @throws PermissionException if the user does not have the privilege
**/ **/
public final void assertPrivilege(PrivilegeDescriptor priv) { public final void assertPrivilege(PrivilegeDescriptor priv) {
Party party = KernelHelper.getCurrentEffectiveParty(); Party party = Kernel.getContext().getEffectiveParty();
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Check privilege " + priv.getName() + s_log.debug("Check privilege " + priv.getName() +
" on object " + getOID() + " against party " + " on object " + getOID() + " against party " +
(party == null ? null : party.getOID())); (party == null ? null : party.getOID()));
} }
PermissionService.assertPermission( PermissionService.assertPermission(new PermissionDescriptor(priv,
new PermissionDescriptor(priv, this, party)); this,
party));
} }
@ -419,9 +420,11 @@ public abstract class ACSObject extends ObservableDomainObject {
* this object, false otherwise * this object, false otherwise
**/ **/
public final boolean checkPrivilege(PrivilegeDescriptor priv) { public final boolean checkPrivilege(PrivilegeDescriptor priv) {
Party party = KernelHelper.getCurrentEffectiveParty(); Party party = Kernel.getContext().getEffectiveParty();
return PermissionService.checkPermission( return PermissionService.checkPermission(new PermissionDescriptor(priv,
new PermissionDescriptor(priv, this, party)); this,
party)
);
} }

View File

@ -23,7 +23,6 @@ import java.util.Locale;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
*
* <p>The entry point into all the global state that CCM code expects to * <p>The entry point into all the global state that CCM code expects to
* have available to it when running, e.g. the current user, the * have available to it when running, e.g. the current user, the
* current resource, etc.</p> * current resource, etc.</p>
@ -40,12 +39,9 @@ import org.apache.log4j.Logger;
* @author Justin Ross * @author Justin Ross
* @see com.arsdigita.kernel.Kernel * @see com.arsdigita.kernel.Kernel
* @see com.arsdigita.kernel.KernelExcursion * @see com.arsdigita.kernel.KernelExcursion
* @version $Id: KernelContext.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public final class KernelContext { public final class KernelContext {
public static final String versionId =
"$Id: KernelContext.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger(KernelContext.class); private static final Logger s_log = Logger.getLogger(KernelContext.class);
@ -106,6 +102,20 @@ public final class KernelContext {
public final Party getParty() { public final Party getParty() {
return m_party; return m_party;
} }
/**
* Returns the current user.
* Backwards compatibility method which returns a user object. Developers
* should use getParty whenever possible (party is an abstraction of users
* as well as groups).
*/
public static User getUser() {
KernelContext kernelContext = Kernel.getContext();
if ( kernelContext.getParty() instanceof User ) {
return (User) kernelContext.getParty();
} else {
return null;
}
}
final void setParty(Party party) { final void setParty(Party party) {
m_party = party; m_party = party;

View File

@ -1,243 +0,0 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.kernel;
import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.web.Web;
import javax.servlet.http.HttpServletRequest;
/**
* Provides static methods for accessing kernel-specific data.
*
* $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
*/
public class KernelHelper {
/**
* Extracts the KernelRequestContext from the given request.
*
* @return the KernelRequestContext.
*
* @throws IllegalStateException if the current request context does not
* subclass KernelRequestContext.
**/
public static KernelRequestContext getKernelRequestContext
(HttpServletRequest req) {
RequestContext rctx = DispatcherHelper.getRequestContext(req);
try {
return (KernelRequestContext)rctx;
} catch (ClassCastException e) {
throw new IllegalStateException
("Request context does not subclass KernelRequestContext: "
+ rctx.getClass().getName());
}
}
/**
* Returns the current HTTP request.
*
* @return the current HTTP request.
*
* @deprecated Use {@link DispatcherHelper#getRequest()}.
**/
public static HttpServletRequest getRequest() {
HttpServletRequest r = DispatcherHelper.getRequest();
if (r == null) {
throw new IllegalStateException("Request is not set");
}
return r;
}
/**
* Returns the name or IP address of the server, for example
* "www.redhat.com". This may be different from the host name
* the server runs on. It is intended for use in constructing
* URLs that refer back to the server but must be constructed
* outside of an HTTP request context where this information is
* known explicitly.
*
* <p>The value of serverName is controlled by enterprise.init:
* <pre>
* init com.arsdigita.kernel.Initializer {
* hostName = "prd001.redhat.com";
* serverName = "www.redhat.com";
* serverPort = "80";
* }
* </pre>
*
* <p>If serverName is not defined in enterprise.init, this method
* will return hostName. If hostName is not defined it will
* return null.
*
* @version $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
* @deprecated This method now delegates to WebConfig. Use {@link
* com.arsdigita.web.WebConfig#getServer()} and the object it returns instead of this method.
*/
public synchronized static String getServerName() {
return Web.getConfig().getServer().getName();
}
/**
* Returns the port number the server is running on, or null if
* not defined.
*
* @deprecated This method now delegates to WebConfig. Use {@link
* com.arsdigita.web.WebConfig#getServer()} and the object it
* returns instead of this method.
*/
public synchronized static String getServerPort() {
return new Integer(Web.getConfig().getServer().getPort()).toString();
}
/**
* Returns a canonical URL for accessing the server, constructed
* from the values of {@link #getServerName} and {@link
* #getServerPort}. If the server port is not defined or set to
* the standard HTTP port 80 it will not be included in the
* URL. If neither the server name nor port are defined, the return
* value is simply "http://localhost/".
*
* @deprecated Use <code>"http://" + Web.getConfig().getServer() +
* "/"</code> instead.
*/
public synchronized static String getServerURL() {
StringBuffer sb = new StringBuffer();
sb.append("http://");
String serverName = getServerName();
if (null == serverName) {
sb.append("localhost");
} else {
sb.append(serverName);
}
String serverPort = getServerPort();
if (serverPort != null && !serverPort.equals("80")) {
sb.append(':').append(serverPort);
}
return sb.toString();
}
/**
* Retrieves the host name for this server (for example, "arsDigita.com").
* The value is controlled by enterprise.init:
* <pre>
* init com.arsdigita.kernel.Initializer {
* hostName = "redhat.com";
* siteName = "Red Hat Web Site";
* }
* </pre>
*
* @return the host name.
* @deprecated This method will no longer exist in an upcoming
* release.
*/
public synchronized static String getHostName() {
return Web.getConfig().getHost().getName();
}
/**
* Retrieves the site name for this server (for example, "Red Hat Web Site").
* The value is controlled by enterprise.init:
* <pre>
* init com.arsdigita.kernel.Initializer {
* hostName = "redhat.com";
* siteName = "Red Hat Web Site";
* }
* </pre>
*
* @return the site name.
* @deprecated Use <code>Web.getConfig().getSiteName()</code>
* instead.
*/
public synchronized static String getSiteName() {
return Web.getConfig().getSiteName();
}
/**
*
*
* Get the system administrator's email address. It returns the
* email address specified in kernel initializer as
* systemAdministratorEmailAddress. This method is only to be
* used to obtain a reply-to address for notifications. <b>The
* return value may or may not correspond to an actual user
* account on the system.</b>.
*
* <p>For example, when a user tries to change their password,
* they receive confirmation via email. This email must appear to
* originate from a valid email address on the system. Ideally it
* will also correspond to a real person who can be replied to for
* help.
*
* @return email address suitable for reply-to in system notifications
* @deprecated Use <code>Kernel.getSecurityConfig().getAdminContactEmail()</code>
*/
public static synchronized String getSystemAdministratorEmailAddress() {
return Kernel.getSecurityConfig().getAdminContactEmail();
}
/**
*
*
* Fetches the currently logged in user, or null. This is a
* convenience wrapper around {@link #getCurrentUser()}. In the
* general case, those are preferrable.
*
* @param request The HTTP request
* @return The currently logged-in user, or null if there is none.
* @throws RuntimeException if the logged-in user doesn't exist in
* the database
* @deprecated See getCurrentUser()
**/
public static User getCurrentUser(HttpServletRequest request) {
return getCurrentUser();
}
/**
* Returns the current user.
*
* @deprecated Call {@link KernelContext#getParty()} e.g.,
* Kernel.getContext().getParty().
*/
public static User getCurrentUser() {
KernelContext kernelContext = Kernel.getContext();
if ( kernelContext.getParty() instanceof User ) {
return (User) kernelContext.getParty();
} else {
return null;
}
}
public static Party getCurrentParty() {
KernelContext kernelContext = Kernel.getContext();
return kernelContext.getParty();
}
public static Party getCurrentEffectiveParty() {
KernelContext kernelContext = Kernel.getContext();
return kernelContext.getEffectiveParty();
}
}

View File

@ -0,0 +1,248 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.kernel;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext;
import javax.servlet.http.HttpServletRequest;
/**
* Provides static methods for accessing kernel-specific data.
*
* $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
*/
public class KernelHelper {
// /**
// * Extracts the KernelRequestContext from the given request.
// *
// * @return the KernelRequestContext.
// *
// * @throws IllegalStateException if the current request context does not
// * subclass KernelRequestContext.
// */
// public static KernelRequestContext getKernelRequestContext
// (HttpServletRequest req) {
// RequestContext rctx = DispatcherHelper.getRequestContext(req);
// try {
// return (KernelRequestContext)rctx;
// } catch (ClassCastException e) {
// throw new IllegalStateException
// ("Request context does not subclass KernelRequestContext: "
// + rctx.getClass().getName());
// }
// }
// /**
// * Returns the current HTTP request.
// *
// * @return the current HTTP request.
// *
// * @deprecated Use {@link DispatcherHelper#getRequest()}.
// */
// public static HttpServletRequest getRequest() {
// HttpServletRequest r = DispatcherHelper.getRequest();
// if (r == null) {
// throw new IllegalStateException("Request is not set");
// }
// return r;
// }
// /**
// * Returns the name or IP address of the server, for example
// * "www.redhat.com". This may be different from the host name
// * the server runs on. It is intended for use in constructing
// * URLs that refer back to the server but must be constructed
// * outside of an HTTP request context where this information is
// * known explicitly.
// *
// * <p>The value of serverName is controlled by enterprise.init:
// * <pre>
// * init com.arsdigita.kernel.Initializer {
// * hostName = "prd001.redhat.com";
// * serverName = "www.redhat.com";
// * serverPort = "80";
// * }
// * </pre>
// *
// * <p>If serverName is not defined in enterprise.init, this method
// * will return hostName. If hostName is not defined it will
// * return null.
// *
// * @version $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
// * @deprecated This method now delegates to WebConfig. Use {@link
// * com.arsdigita.web.WebConfig#getServer()} and the object it returns instead of this method.
// */
// public synchronized static String getServerName() {
// return Web.getConfig().getServer().getName();
// }
// /**
// * Returns the port number the server is running on, or null if
// * not defined.
// *
// * @deprecated This method now delegates to WebConfig. Use {@link
// * com.arsdigita.web.WebConfig#getServer()} and the object it
// * returns instead of this method.
// */
// public synchronized static String getServerPort() {
// return new Integer(Web.getConfig().getServer().getPort()).toString();
// }
// /**
// * Returns a canonical URL for accessing the server, constructed
// * from the values of {@link #getServerName} and {@link
// * #getServerPort}. If the server port is not defined or set to
// * the standard HTTP port 80 it will not be included in the
// * URL. If neither the server name nor port are defined, the return
// * value is simply "http://localhost/".
// *
// * @ deprecated Use <code>"http://" + Web.getConfig().getServer() +
// * "/"</code> instead.
// */
// public synchronized static String getServerURL() {
// StringBuffer sb = new StringBuffer();
// sb.append("http://");
//
// String serverName = getServerName();
// if (null == serverName) {
// sb.append("localhost");
// } else {
// sb.append(serverName);
// }
//
// String serverPort = getServerPort();
// if (serverPort != null && !serverPort.equals("80")) {
// sb.append(':').append(serverPort);
// }
//
// return sb.toString();
// }
// /**
// * Retrieves the host name for this server (for example, "arsDigita.com").
// * The value is controlled by enterprise.init:
// * <pre>
// * init com.arsdigita.kernel.Initializer {
// * hostName = "redhat.com";
// * siteName = "Red Hat Web Site";
// * }
// * </pre>
// *
// * @return the host name.
// * @deprecated This method will no longer exist in an upcoming
// * release.
// */
// public synchronized static String getHostName() {
// return Web.getConfig().getHost().getName();
// }
// /**
// * Retrieves the site name for this server (for example, "Red Hat Web Site").
// * The value is controlled by enterprise.init:
// * <pre>
// * init com.arsdigita.kernel.Initializer {
// * hostName = "redhat.com";
// * siteName = "Red Hat Web Site";
// * }
// * </pre>
// *
// * @return the site name.
// * @deprecated Use <code>Web.getConfig().getSiteName()</code>
// * instead.
// */
// public synchronized static String getSiteName() {
// return Web.getConfig().getSiteName();
// }
// /**
// * Get the system administrator's email address. It returns the
// * email address specified in kernel initializer as
// * systemAdministratorEmailAddress. This method is only to be
// * used to obtain a reply-to address for notifications. <b>The
// * return value may or may not correspond to an actual user
// * account on the system.</b>.
// *
// * <p>For example, when a user tries to change their password,
// * they receive confirmation via email. This email must appear to
// * originate from a valid email address on the system. Ideally it
// * will also correspond to a real person who can be replied to for
// * help.
// *
// * @return email address suitable for reply-to in system notifications
// * @deprecated Use <code>Kernel.getSecurityConfig().getAdminContactEmail()</code>
// */
// public static synchronized String getSystemAdministratorEmailAddress() {
// return Kernel.getSecurityConfig().getAdminContactEmail();
// }
// /**
// * Fetches the currently logged in user, or null. This is a
// * convenience wrapper around {@link #getCurrentUser()}. In the
// * general case, those are preferrable.
// *
// * @param request The HTTP request
// * @return The currently logged-in user, or null if there is none.
// * @throws RuntimeException if the logged-in user doesn't exist in
// * the database
// * @ deprecated See getCurrentUser()
// **/
// public static User getCurrentUser(HttpServletRequest request) {
// return getCurrentUser();
// }
// /**
// * Returns the current user.
// *
// * @deprecated Call {@link KernelContext#getParty()} e.g.,
// * Kernel.getContext().getUser().
// */
// public static User getCurrentUser() {
// KernelContext kernelContext = Kernel.getContext();
// if ( kernelContext.getParty() instanceof User ) {
// return (User) kernelContext.getParty();
// } else {
// return null;
// }
// }
// /**
// * Returns the current party.
// *
// * @deprecated Call {@link KernelContext#getParty()} e.g.,
// * Kernel.getContext().getParty().
// */
// public static Party getCurrentParty() {
// KernelContext kernelContext = Kernel.getContext();
// return kernelContext.getParty();
// }
// /**
// * Returns the current effective party.
// *
// * @deprecated Call {@link KernelContext#getParty()} e.g.,
// * Kernel.getContext().getEffectiveParty().
// */
// public static Party getCurrentEffectiveParty() {
// KernelContext kernelContext = Kernel.getContext();
// return kernelContext.getEffectiveParty();
// }
}

View File

@ -18,10 +18,12 @@
*/ */
package com.arsdigita.kernel; package com.arsdigita.kernel;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.security.SessionContext; import com.arsdigita.kernel.security.SessionContext;
import com.arsdigita.kernel.security.UserContext; import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.dispatcher.InitialRequestContext; import com.arsdigita.dispatcher.InitialRequestContext;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -44,6 +46,27 @@ public class KernelRequestContext extends InitialRequestContext {
m_user = user; m_user = user;
} }
/**
* Extracts the KernelRequestContext from the given request.
*
* @return the KernelRequestContext.
* @throws IllegalStateException if the current request context does not
* subclass KernelRequestContext.
*/
public static KernelRequestContext getKernelRequestContext
(HttpServletRequest req) {
RequestContext rctx = DispatcherHelper.getRequestContext(req);
try {
return (KernelRequestContext)rctx;
} catch (ClassCastException e) {
throw new IllegalStateException
("Request context does not subclass KernelRequestContext: "
+ rctx.getClass().getName());
}
}
/** /**
* Copy constructor. * Copy constructor.
**/ **/

View File

@ -108,6 +108,7 @@ public class SiteNode extends ACSObject {
} }
@Override @Override
@Deprecated
protected void initialize() { protected void initialize() {
super.initialize(); super.initialize();
if (isNew()) { if (isNew()) {
@ -503,6 +504,7 @@ public class SiteNode extends ACSObject {
return getSiteNode(path, false); return getSiteNode(path, false);
} }
@Deprecated
public static SiteNode createSiteNode(String name) { public static SiteNode createSiteNode(String name) {
return createSiteNode(name, getRootSiteNode()); return createSiteNode(name, getRootSiteNode());
} }
@ -522,10 +524,12 @@ public class SiteNode extends ACSObject {
super.beforeSave(); super.beforeSave();
} }
@Deprecated
public void afterDelete() { public void afterDelete() {
s_cache.scheduleRefresh(); s_cache.scheduleRefresh();
} }
@Deprecated
public static SiteNode createSiteNode(String name, SiteNode parent) { public static SiteNode createSiteNode(String name, SiteNode parent) {
SiteNode siteNode = new SiteNode(); SiteNode siteNode = new SiteNode();
siteNode.setName(name); siteNode.setName(name);
@ -535,6 +539,7 @@ public class SiteNode extends ACSObject {
} }
@Override @Override
@Deprecated
public String toString() { public String toString() {
return "[url: " + getURL() + "]"; return "[url: " + getURL() + "]";
} }
@ -590,6 +595,7 @@ public class SiteNode extends ACSObject {
} }
@Override @Override
@Deprecated
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj==null) { return false; } if (obj==null) { return false; }
@ -599,11 +605,13 @@ public class SiteNode extends ACSObject {
} }
@Override @Override
@Deprecated
public int hashCode() { public int hashCode() {
return m_node.getID().hashCode() + m_node.getURL().hashCode(); return m_node.getID().hashCode() + m_node.getURL().hashCode();
} }
@Override @Override
@Deprecated
public String toString() { public String toString() {
return m_node.toString(); return m_node.toString();
} }
@ -611,13 +619,16 @@ public class SiteNode extends ACSObject {
// Caching of Site Nodes // Caching of Site Nodes
// Stores the cached (url, siteNode) mappings. // Stores the cached (url, siteNode) mappings.
@Deprecated
private static class Cache extends PathMapCache { private static class Cache extends PathMapCache {
@Deprecated
public Cache() { public Cache() {
super("SiteNodeCache"); super("SiteNodeCache");
} }
// implements the PathMapCache interface // implements the PathMapCache interface
@Deprecated
public String normalize(String path) { public String normalize(String path) {
if ( path==null ) { throw new NullPointerException("path"); } if ( path==null ) { throw new NullPointerException("path"); }
if ( !path.startsWith("/") ) { if ( !path.startsWith("/") ) {
@ -628,6 +639,7 @@ public class SiteNode extends ACSObject {
} }
// implements the PathMapCache interface // implements the PathMapCache interface
@Deprecated
public Object retrieve(String path) { public Object retrieve(String path) {
DataCollection dc = SessionManager.getSession().retrieve DataCollection dc = SessionManager.getSession().retrieve
("com.arsdigita.kernel.SiteNode"); ("com.arsdigita.kernel.SiteNode");
@ -650,14 +662,17 @@ public class SiteNode extends ACSObject {
} }
// implements the PathMapCache interface // implements the PathMapCache interface
@Deprecated
public void refresh() { public void refresh() {
clearAll(); clearAll();
} }
@Deprecated
void scheduleRefresh() { void scheduleRefresh() {
super.refreshAfterCommit(); super.refreshAfterCommit();
} }
@Deprecated
synchronized SiteNode getNode(String path) { synchronized SiteNode getNode(String path) {
SiteNodeWrapper snw = (SiteNodeWrapper) super.get(path); SiteNodeWrapper snw = (SiteNodeWrapper) super.get(path);
return snw.m_node; return snw.m_node;

View File

@ -23,7 +23,6 @@ import com.arsdigita.web.Web;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
@ -69,6 +68,7 @@ class Permission extends DomainObject {
static final String BASE_DATA_OBJECT_TYPE = static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.kernel.permissions.Permission"; "com.arsdigita.kernel.permissions.Permission";
@Override
protected String getBaseDataObjectType() { protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE; return BASE_DATA_OBJECT_TYPE;
} }
@ -243,7 +243,7 @@ class Permission extends DomainObject {
RuntimeException("Permission entries cannot be modified"); RuntimeException("Permission entries cannot be modified");
} }
Party party = KernelHelper.getCurrentEffectiveParty(); Party party = Kernel.getContext().getEffectiveParty();
if (party == null if (party == null
|| !party.getID().equals(Kernel.getSystemParty().getID())) { || !party.getID().equals(Kernel.getSystemParty().getID())) {

View File

@ -22,7 +22,7 @@ import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.GlobalObserver; import com.arsdigita.domain.GlobalObserver;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Party;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.metadata.ObjectType; import com.arsdigita.persistence.metadata.ObjectType;
@ -93,7 +93,7 @@ public class PermissionsObserver implements GlobalObserver {
} }
private boolean isKernelMode() { private boolean isKernelMode() {
Party currentParty = KernelHelper.getCurrentEffectiveParty(); Party currentParty = Kernel.getContext().getEffectiveParty();
return (currentParty != null && return (currentParty != null &&
currentParty.getID().equals(Kernel.getSystemParty().getID())); currentParty.getID().equals(Kernel.getSystemParty().getID()));

View File

@ -36,13 +36,22 @@ import org.apache.log4j.Logger;
* @see CookieLoginModule * @see CookieLoginModule
* *
* @author Sameer Ajmani * @author Sameer Ajmani
**/ * @version $Id: CookieManager.java 1477 2007-03-14 10:27:16Z chrisgilbert23 $
*/
public class CookieManager extends CredentialManager { public class CookieManager extends CredentialManager {
public static final String versionId = "$Id: CookieManager.java 1477 2007-03-14 10:27:16Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(CookieManager.class.getName()); Logger.getLogger(CookieManager.class.getName());
/**
*
* @param module
* @param subject
* @param handler
* @param shared
* @param options
*/
@Override
public void initialize(CredentialLoginModule module, public void initialize(CredentialLoginModule module,
Subject subject, Subject subject,
CallbackHandler handler, CallbackHandler handler,
@ -58,7 +67,7 @@ public class CookieManager extends CredentialManager {
* *
* @return <code>true</code> if the credential is not set or has the * @return <code>true</code> if the credential is not set or has the
* wrong value or should be renewed, <code>false</code> otherwise. * wrong value or should be renewed, <code>false</code> otherwise.
**/ */
protected boolean shouldSetValue(String value) protected boolean shouldSetValue(String value)
throws LoginException { throws LoginException {
if (getModule().requestIsExcluded()) { if (getModule().requestIsExcluded()) {
@ -80,7 +89,7 @@ public class CookieManager extends CredentialManager {
* current request. * current request.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
protected final String getValue() protected final String getValue()
throws LoginException { throws LoginException {
s_log.debug("START getValue"); s_log.debug("START getValue");
@ -100,7 +109,7 @@ public class CookieManager extends CredentialManager {
* the given value. * the given value.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
protected final void setValue(String value) protected final void setValue(String value)
throws LoginException { throws LoginException {
// now we don't automatically set the duration to getCookieMaxAge() // now we don't automatically set the duration to getCookieMaxAge()
@ -118,7 +127,7 @@ public class CookieManager extends CredentialManager {
* <code>getModule().getCredentialName()</code>. * <code>getModule().getCredentialName()</code>.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
protected final void deleteValue() protected final void deleteValue()
throws LoginException { throws LoginException {
deleteCookie(getModule().getCredentialName()); deleteCookie(getModule().getCredentialName());
@ -126,7 +135,7 @@ public class CookieManager extends CredentialManager {
/** /**
* Deletes the named cookie. * Deletes the named cookie.
**/ */
private void deleteCookie(String name) private void deleteCookie(String name)
throws LoginException { throws LoginException {
if (isCookieSet(name)) { if (isCookieSet(name)) {
@ -157,7 +166,7 @@ public class CookieManager extends CredentialManager {
/** /**
* Sets the named cookie to the given value. * Sets the named cookie to the given value.
**/ */
private void setCookie(String name, String value, int maxAge) private void setCookie(String name, String value, int maxAge)
throws LoginException { throws LoginException {
Cookie cookie = new Cookie(name, value); Cookie cookie = new Cookie(name, value);
@ -176,7 +185,7 @@ public class CookieManager extends CredentialManager {
/** /**
* Determines the lifespan of the cookie, using the setting * Determines the lifespan of the cookie, using the setting
* of the configuration, defaulting to getCookieMaxAge(). * of the configuration, defaulting to getCookieMaxAge().
**/ */
protected int getCookieAge() throws LoginException { protected int getCookieAge() throws LoginException {
Integer setting = Kernel.getSecurityConfig().getCookieDurationMinutes(); Integer setting = Kernel.getSecurityConfig().getCookieDurationMinutes();
return (setting == null ? getCookieMaxAge() : setting.intValue() * 60); return (setting == null ? getCookieMaxAge() : setting.intValue() * 60);
@ -189,7 +198,7 @@ public class CookieManager extends CredentialManager {
* *
* @return <code>FOREVER_SECS</code> if the user has requested permanent * @return <code>FOREVER_SECS</code> if the user has requested permanent
* login; -1 otherwise. * login; -1 otherwise.
**/ */
protected int getCookieMaxAge() throws LoginException { protected int getCookieMaxAge() throws LoginException {
return getModule().getForever() ? return getModule().getForever() ?
(int)CredentialLoginModule.FOREVER_SECS : -1; (int)CredentialLoginModule.FOREVER_SECS : -1;

View File

@ -215,7 +215,8 @@ public class Credential {
final byte[] validator; final byte[] validator;
final byte[] calculated; final byte[] calculated;
try { try {
validator = (new Base64()).decode(tok.nextToken().getBytes(Crypto.CHARACTER_ENCODING)); validator = (new Base64()).decode(tok.nextToken()
.getBytes(Crypto.CHARACTER_ENCODING));
calculated = createValidator(value, expiration, mac); calculated = createValidator(value, expiration, mac);
} catch (ValidatorException ex) { } catch (ValidatorException ex) {
throw new CredentialParsingException(ex.getRootCause()); throw new CredentialParsingException(ex.getRootCause());

View File

@ -38,11 +38,11 @@ import org.apache.log4j.Logger;
* <code>Class.forName()</code>. The JAAS bug will be fixed in JDK 1.4. * <code>Class.forName()</code>. The JAAS bug will be fixed in JDK 1.4.
* *
* @author Sameer Ajmani * @author Sameer Ajmani
* @version $Id: LoginContext.java 287 2005-02-22 00:29:02Z sskracic $
**/ **/
public class LoginContext { public class LoginContext {
private final static Logger s_log = Logger.getLogger( LoginContext.class ); private final static Logger s_log = Logger.getLogger( LoginContext.class );
public static final String versionId = "$Id: LoginContext.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private Subject m_subject; private Subject m_subject;
private CallbackHandler m_handler; private CallbackHandler m_handler;
private Map m_shared = new HashMap(); private Map m_shared = new HashMap();
@ -51,7 +51,7 @@ public class LoginContext {
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public LoginContext(String name) public LoginContext(String name)
throws LoginException { throws LoginException {
this(name, new Subject()); this(name, new Subject());
@ -59,7 +59,7 @@ public class LoginContext {
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public LoginContext(String name, public LoginContext(String name,
Subject subject) Subject subject)
throws LoginException { throws LoginException {
@ -76,7 +76,7 @@ public class LoginContext {
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public LoginContext(String name, public LoginContext(String name,
CallbackHandler handler) CallbackHandler handler)
throws LoginException { throws LoginException {
@ -85,7 +85,7 @@ public class LoginContext {
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public LoginContext(String name, public LoginContext(String name,
Subject subject, Subject subject,
CallbackHandler handler) CallbackHandler handler)
@ -142,14 +142,14 @@ public class LoginContext {
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public Subject getSubject() { public Subject getSubject() {
return m_subject; return m_subject;
} }
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public void login() throws LoginException { public void login() throws LoginException {
LoginException first = null; LoginException first = null;
boolean gotFailure = false; boolean gotFailure = false;
@ -256,7 +256,7 @@ public class LoginContext {
/** /**
* See <code>javax.security.auth.login.LoginContext</code>. * See <code>javax.security.auth.login.LoginContext</code>.
**/ */
public void logout() throws LoginException { public void logout() throws LoginException {
LoginException first = null; LoginException first = null;
// logout // logout

View File

@ -37,17 +37,17 @@ import org.apache.log4j.Logger;
* username/password in shared data for use by other LoginModules. * username/password in shared data for use by other LoginModules.
* *
* @author Sameer Ajmani * @author Sameer Ajmani
* @version $Id: PasswordLoginModule.java 287 2005-02-22 00:29:02Z sskracic $
**/ **/
public abstract class PasswordLoginModule implements LoginModule { public abstract class PasswordLoginModule implements LoginModule {
public static final String versionId = "$Id: PasswordLoginModule.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(PasswordLoginModule.class.getName()); Logger.getLogger(PasswordLoginModule.class.getName());
/** Key for username in shared data map. **/ /** Key for username in shared data map. */
public static final String NAME_KEY public static final String NAME_KEY
= "javax.security.auth.login.name"; = "javax.security.auth.login.name";
/** Key for password in shared data map. **/ /** Key for password in shared data map. */
public static final String PASSWORD_KEY public static final String PASSWORD_KEY
= "javax.security.auth.login.password"; = "javax.security.auth.login.password";
@ -79,7 +79,7 @@ public abstract class PasswordLoginModule implements LoginModule {
* thrown by the <code>checkPassword</code> method. * thrown by the <code>checkPassword</code> method.
* *
* @see #checkPassword(String, char[]) * @see #checkPassword(String, char[])
**/ */
public boolean login() throws LoginException { public boolean login() throws LoginException {
s_log.debug("START login"); s_log.debug("START login");
checkPassword(getUsername(), getPassword()); checkPassword(getUsername(), getPassword());
@ -94,7 +94,7 @@ public abstract class PasswordLoginModule implements LoginModule {
* @return the username. * @return the username.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
private String getUsername() throws LoginException { private String getUsername() throws LoginException {
// get name from shared data // get name from shared data
// TODO: only if *Pass option set // TODO: only if *Pass option set
@ -123,7 +123,7 @@ public abstract class PasswordLoginModule implements LoginModule {
* @return the password. * @return the password.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
private char[] getPassword() throws LoginException { private char[] getPassword() throws LoginException {
// get password from shared data // get password from shared data
// TODO: only if *Pass option set // TODO: only if *Pass option set
@ -157,7 +157,7 @@ public abstract class PasswordLoginModule implements LoginModule {
* @throws AccountLockedException if the account is locked. * @throws AccountLockedException if the account is locked.
* @throws FailedLoginException if the password is invalid. * @throws FailedLoginException if the password is invalid.
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
protected abstract void checkPassword protected abstract void checkPassword
(String username, char[] password) throws LoginException; (String username, char[] password) throws LoginException;

View File

@ -30,10 +30,10 @@ import org.apache.log4j.Logger;
* authentication URL parameter. * authentication URL parameter.
* *
* @author Sameer Ajmani * @author Sameer Ajmani
* @version $Id: RecoveryLoginModule.java 287 2005-02-22 00:29:02Z sskracic $
**/ **/
public class RecoveryLoginModule extends UserLoginModule { public class RecoveryLoginModule extends UserLoginModule {
public static final String versionId = "$Id: RecoveryLoginModule.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(RecoveryLoginModule.class.getName()); Logger.getLogger(RecoveryLoginModule.class.getName());
@ -50,7 +50,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* credential value. Overrides <code>URLManager.shouldSetValue()</code> * credential value. Overrides <code>URLManager.shouldSetValue()</code>
* to return <code>false</code> so that the recover credential is never * to return <code>false</code> so that the recover credential is never
* propagated to future requests. * propagated to future requests.
**/ */
public RecoveryLoginModule() { public RecoveryLoginModule() {
super(new URLManager(java.util.Collections.EMPTY_SET) { super(new URLManager(java.util.Collections.EMPTY_SET) {
/** /**
@ -59,6 +59,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* *
* @return false * @return false
**/ **/
@Override
protected boolean shouldSetValue(String value) protected boolean shouldSetValue(String value)
throws LoginException { throws LoginException {
return false; return false;
@ -67,6 +68,7 @@ public class RecoveryLoginModule extends UserLoginModule {
} }
// implements LoginModule // implements LoginModule
@Override
public void initialize(Subject subject, public void initialize(Subject subject,
CallbackHandler handler, CallbackHandler handler,
Map shared, Map shared,
@ -85,7 +87,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* @return <code>super.commit()</code>. * @return <code>super.commit()</code>.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
public boolean commit() public boolean commit()
throws LoginException { throws LoginException {
if (credentialIsSet()) { if (credentialIsSet()) {
@ -101,7 +103,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* @return <code>this.commit()</code>. * @return <code>this.commit()</code>.
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
public boolean abort() public boolean abort()
throws LoginException { throws LoginException {
return this.commit(); return this.commit();
@ -113,7 +115,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* @return getParamName() * @return getParamName()
* *
* @throws LoginException if an error occurs. * @throws LoginException if an error occurs.
**/ */
protected String getCredentialName() protected String getCredentialName()
throws LoginException { throws LoginException {
return getParamName(); return getParamName();
@ -125,7 +127,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* recovery credential is used check whether the user is recovering. * recovery credential is used check whether the user is recovering.
* *
* @see #isRecovering(Subject) * @see #isRecovering(Subject)
**/ */
private void setRecovering() { private void setRecovering() {
s_log.debug("setting recovery credential"); s_log.debug("setting recovery credential");
m_subject.getPublicCredentials().add(getParamName()); m_subject.getPublicCredentials().add(getParamName());
@ -137,7 +139,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* *
* @return <code>true</code> if the Subject has the recovery credential, * @return <code>true</code> if the Subject has the recovery credential,
* <code>false</code> otherwise. * <code>false</code> otherwise.
**/ */
public static boolean isRecovering(Subject subject) { public static boolean isRecovering(Subject subject) {
return subject.getPublicCredentials().contains(getParamName()); return subject.getPublicCredentials().contains(getParamName());
} }
@ -150,7 +152,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* *
* @return the name of the recovery login URL parameter. * @return the name of the recovery login URL parameter.
* @see #getParamValue(BigDecimal) * @see #getParamValue(BigDecimal)
**/ */
public static String getParamName() { public static String getParamName() {
return URL_PARAM_NAME; return URL_PARAM_NAME;
} }
@ -167,7 +169,7 @@ public class RecoveryLoginModule extends UserLoginModule {
* @throws CredentialEncodingException if unable to create the value. * @throws CredentialEncodingException if unable to create the value.
* *
* @see #getParamName() * @see #getParamName()
**/ */
public static String getParamValue(BigDecimal userID) public static String getParamValue(BigDecimal userID)
throws CredentialEncodingException { throws CredentialEncodingException {
return Credential return Credential

View File

@ -21,8 +21,7 @@ package com.arsdigita.kernel.security;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* Provides methods for * Provides methods for determining security properties for a request.
* determining security properties for a request.
* *
* @author Sameer Ajmani * @author Sameer Ajmani
* @version $Id: SecurityHelper.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: SecurityHelper.java 287 2005-02-22 00:29:02Z sskracic $

View File

@ -19,7 +19,6 @@
package com.arsdigita.kernel.security; package com.arsdigita.kernel.security;
import com.arsdigita.util.ParameterProvider; import com.arsdigita.util.ParameterProvider;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.KernelRequestContext; import com.arsdigita.kernel.KernelRequestContext;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -60,7 +59,7 @@ public class SecurityParameterProvider implements ParameterProvider {
public Set getParams(HttpServletRequest req) { public Set getParams(HttpServletRequest req) {
// get user and session info // get user and session info
KernelRequestContext rctx = KernelRequestContext rctx =
KernelHelper.getKernelRequestContext(req); KernelRequestContext.getKernelRequestContext(req);
// Request context can be null e.g. if called in a request listener // Request context can be null e.g. if called in a request listener
if ( rctx == null ) { if ( rctx == null ) {

View File

@ -20,11 +20,11 @@ package com.arsdigita.kernel.security;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
/** /**
* Provide access to the JSESSIONID value as a BigDecimal. This class * Provide access to the JSESSIONID value as a BigDecimal. This class

View File

@ -148,6 +148,7 @@ public class SiteNodeRequestContext extends KernelRequestContext {
/** /**
* @return the site node referenced by this request. * @return the site node referenced by this request.
* @deprecated
*/ */
public SiteNode getSiteNode() { public SiteNode getSiteNode() {
return m_sn; return m_sn;

View File

@ -19,9 +19,9 @@
package com.arsdigita.templating; package com.arsdigita.templating;
import com.arsdigita.dispatcher.DispatcherHelper; // import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.sitenode.SiteNodeRequestContext; // import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.kernel.SiteNode; // import com.arsdigita.kernel.SiteNode;
import com.arsdigita.web.Web; import com.arsdigita.web.Web;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
@ -74,7 +74,10 @@ public class ApplicationPatternGenerator implements PatternGenerator {
s_log.debug("ApplicationType for >>" +key + s_log.debug("ApplicationType for >>" +key +
"<< not found. Trying SiteNodes instead."); "<< not found. Trying SiteNodes instead.");
throw new IllegalArgumentException(
"No ApplicationType found for type name " + key);
/*
SiteNodeRequestContext ctx = (SiteNodeRequestContext) SiteNodeRequestContext ctx = (SiteNodeRequestContext)
DispatcherHelper.getRequestContext(req); DispatcherHelper.getRequestContext(req);
@ -90,7 +93,7 @@ public class ApplicationPatternGenerator implements PatternGenerator {
s_log.debug("ApplicationType for " +key + s_log.debug("ApplicationType for " +key +
" could not be found in SiteNodes either. Returning empty String[]"); " could not be found in SiteNodes either. Returning empty String[]");
*/
return new String[] {}; // return new String[] {};
} }
} }

View File

@ -19,15 +19,11 @@
package com.arsdigita.templating; package com.arsdigita.templating;
import com.arsdigita.web.Web;
import com.arsdigita.util.StringUtils;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.kernel.SiteNode;
import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.util.StringUtils;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import com.arsdigita.web.Web;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -151,20 +147,12 @@ public class URLPatternGenerator implements PatternGenerator {
* (i.e. application's PrimaryURL). If no application can be found or * (i.e. application's PrimaryURL). If no application can be found or
* no PrimaryURL can be determined ROOT ("/") is returned. * no PrimaryURL can be determined ROOT ("/") is returned.
* *
* XXX fix me, why can't we get this from Web.getConfig.getRequestURL * XXX fix me, why can't we get this from Web.getContext().getRequestURL
* *
* @return primary url of an application or ROOT * @return primary url of an application or ROOT
*/ */
private String getBasePath() { private String getBasePath() {
// OLD code using kernel.SiteNode etc which is deprecatged and no longer
// available
// SiteNodeRequestContext ctx = (SiteNodeRequestContext)
// DispatcherHelper.getRequestContext(Web.getRequest());
// SiteNode node = ctx.getSiteNode();
// Assert.exists(node, SiteNode.class);
// return node.getURL();
// retrieve the application of the request // retrieve the application of the request
Application app = Web.getContext().getApplication(); Application app = Web.getContext().getApplication();
if (app == null) { if (app == null) {
@ -172,6 +160,7 @@ public class URLPatternGenerator implements PatternGenerator {
} else { } else {
return app.getPrimaryURL(); return app.getPrimaryURL();
} }
} }
} }

View File

@ -22,10 +22,8 @@ import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
/** /**
* <p> * Utility class for package toolbox.ui, providing methods to simplify
* . * globalizing keys.
* Contains methods to simplify globalizing keys
* </p>
* *
* @version $Revision: #6 $ $Date: 2004/08/16 $ * @version $Revision: #6 $ $Date: 2004/08/16 $
*/ */

View File

@ -145,7 +145,7 @@ public class AdminServlet extends BaseApplicationServlet
/** /**
* Adds one Url-Page mapping to the internal mapping table. * Adds one pair of Url - Page to the internal hash map, used as a cache.
* *
* @param pathInfo url stub for a page to display * @param pathInfo url stub for a page to display
* @param page Page object to display * @param page Page object to display
@ -173,9 +173,7 @@ public class AdminServlet extends BaseApplicationServlet
p.addGlobalStateParam(GROUP_ID_PARAM); p.addGlobalStateParam(GROUP_ID_PARAM);
// p.addGlobalStateParam(APPLICATIONS_ID_PARAM); // p.addGlobalStateParam(APPLICATIONS_ID_PARAM);
/** /* Create User split panel. */
* Create User split panel.
*/
AdminSplitPanel userSplitPanel = AdminSplitPanel userSplitPanel =
new AdminSplitPanel(USER_NAVBAR_TITLE); new AdminSplitPanel(USER_NAVBAR_TITLE);

View File

@ -6,15 +6,10 @@ package com.arsdigita.ui.admin;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.SplitPanel; import com.arsdigita.bebop.SplitPanel;
import com.arsdigita.bebop.event.ChangeEvent; import com.arsdigita.bebop.event.ChangeEvent;
import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.ui.sitemap.SiteListing;
import com.arsdigita.ui.sitemap.SiteMapAdminPane;
import java.math.BigDecimal;
/** /**
* *
@ -36,19 +31,13 @@ public class ApplicationsAdministrationTab extends BoxPanel
setAttribute("navbar-title", "Sitemap"); setAttribute("navbar-title", "Sitemap");
// m_componentList = new ArrayList(); // m_componentList = new ArrayList();
// m_keys = new ArrayList(); // m_keys = new ArrayList();
SiteListing listing = new SiteListing();
listing.setClassAttr("navbar");
SingleSelectionModel m = listing.getTree().getSelectionModel();
SiteMapAdminPane details = new SiteMapAdminPane(m, listing.getCFGLink());
BoxPanel box = new BoxPanel(); BoxPanel box = new BoxPanel();
box.setClassAttr("main"); box.setClassAttr("main");
box.add(details);
SplitPanel panel = new SplitPanel(); SplitPanel panel = new SplitPanel();
panel.setClassAttr("sidebarNavPanel"); panel.setClassAttr("sidebarNavPanel");
panel.setLeftComponent(listing);
panel.setRightComponent(box); panel.setRightComponent(box);

View File

@ -75,7 +75,8 @@ public interface LoginConstants
public final static String FORM_SCREEN_NAME = public final static String FORM_SCREEN_NAME =
"screenName"; "screenName";
// Should not really be named email. Kept this way due to external tests depending on this value. // Should not really be named email. Kept this way due to external tests
// depending on this value.
public final static String FORM_LOGIN = public final static String FORM_LOGIN =
"email"; "email";

View File

@ -68,19 +68,16 @@ public class LoginServlet extends BebopApplicationServlet {
// Define various URLs to subpages of Login to manage administrative tasks. // Define various URLs to subpages of Login to manage administrative tasks.
// //////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////
/** PathInfo into the Login application to access the (optional) newUser /** PathInfo into the Login application to access the (optional) newUser *
* page. Ends with "/" because it is a servlet/directory * page. Ends with "/" because it is a servlet/directory */
*/
public static final String EDIT_USER_PROFILE_PATH_INFO = "/edit-profile/"; public static final String EDIT_USER_PROFILE_PATH_INFO = "/edit-profile/";
/** PathInfo into the Login application to access the (optional) newUser /** PathInfo into the Login application to access the (optional) newUser *
* page. Ends with "/" because it is a servlet/directory * page. Ends with "/" because it is a servlet/directory */
*/
public static final String NEW_USER_PATH_INFO = "/new-user/"; public static final String NEW_USER_PATH_INFO = "/new-user/";
/** PathInfo into the Login application to access the (optional) newUser /** PathInfo into the Login application to access the (optional) newUser *
* page. Ends with "/" because it is a servlet/directory * page. Ends with "/" because it is a servlet/directory */
*/
public static final String CHANGE_USER_PASSWORD_PATH_INFO = "/change-password/"; public static final String CHANGE_USER_PASSWORD_PATH_INFO = "/change-password/";
/** PathInfo into the Login application to access the (optional) newUser /** PathInfo into the Login application to access the (optional) newUser

View File

@ -55,6 +55,7 @@ public class PasswordValidationListener
* Checks whether the string value of the parameter meets minimum-length * Checks whether the string value of the parameter meets minimum-length
* and composition requirements for strong passwords. * and composition requirements for strong passwords.
*/ */
@Override
public void validate(ParameterEvent e) { public void validate(ParameterEvent e) {
super.validate(e); super.validate(e);

View File

@ -18,37 +18,50 @@
*/ */
package com.arsdigita.ui.login; package com.arsdigita.ui.login;
import com.arsdigita.kernel.KernelHelper;
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.kernel.KernelRequestContext; //Previously SNRC (SiteNode)
import com.arsdigita.kernel.User;
import com.arsdigita.kernel.security.UserContext;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
// Note: Previously used SiteNodeRequestContext, nows using KernelRequestContext
// may be one cause that Login doesn't survive if the brwoser window is
// closed.
/** /**
* Initializes the value of the given parameter to the current user's * Initializes the value of the given parameter to the current user's
* screen name. Strangely similar to <code>EmailInitListener</code>. * screen name. Strangely similar to <code>EmailInitListener</code>.
* *
* @author <a href="mailto:cwolfe@redhat.com">Crag Wolfe</a> * @author <a href="mailto:cwolfe@redhat.com">Crag Wolfe</a>
**/ * @version $Id: ScreenNameInitListener.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class ScreenNameInitListener implements FormInitListener { public class ScreenNameInitListener implements FormInitListener {
public static final String versionId = "$Id: ScreenNameInitListener.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
private static Logger s_log = private static Logger s_log =
Logger.getLogger(ScreenNameInitListener.class.getName()); Logger.getLogger(ScreenNameInitListener.class.getName());
private StringParameter m_param; private StringParameter m_param;
/**
*
* @param param
*/
public ScreenNameInitListener(StringParameter param) { public ScreenNameInitListener(StringParameter param) {
m_param = param; m_param = param;
} }
/**
*
* @param event
*/
public void init(FormSectionEvent event) { public void init(FormSectionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
FormData data = event.getFormData(); FormData data = event.getFormData();
s_log.debug("START"); s_log.debug("START");
UserContext ctx = KernelHelper UserContext ctx = KernelRequestContext
.getKernelRequestContext(state.getRequest()) .getKernelRequestContext(state.getRequest())
.getUserContext(); .getUserContext();
if (!ctx.isLoggedIn()) { if (!ctx.isLoggedIn()) {

View File

@ -44,12 +44,9 @@ import javax.servlet.http.HttpServletRequest;
* @author Phong Nguyen * @author Phong Nguyen
* @author Sameer Ajmani * @author Sameer Ajmani
* @version 1.0 * @version 1.0
* @version $Id: UserAuthenticationListener.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class UserAuthenticationListener implements RequestListener { public class UserAuthenticationListener implements RequestListener {
public static final String versionId =
"$Id: UserAuthenticationListener.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/16 18:10:38 $";
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger
(UserAuthenticationListener.class); (UserAuthenticationListener.class);
@ -67,6 +64,8 @@ public class UserAuthenticationListener implements RequestListener {
throw new IllegalStateException("User is not logged in"); throw new IllegalStateException("User is not logged in");
} }
// Note: aborts processing with an internal error if user not logged in!
// Not suiteable just to check log in status.
return Web.getUserContext().getUser(); return Web.getUserContext().getUser();
} }

View File

@ -24,7 +24,6 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleComponent; import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.ui.UI;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationCollection; import com.arsdigita.web.ApplicationCollection;
import com.arsdigita.web.ApplicationType; import com.arsdigita.web.ApplicationType;
@ -74,11 +73,11 @@ public class UserInfo extends SimpleContainer {
// add list of links // add list of links
ListPanel list = new ListPanel(false); ListPanel list = new ListPanel(false);
list.add(new DynamicLink("login.userInfo.logoutLink", list.add(new DynamicLink("login.userInfo.logoutLink",
UI.getLogoutPageURL())); LoginServlet.getLogoutPageURL()));
list.add(new DynamicLink("login.userInfo.editProfileLink", list.add(new DynamicLink("login.userInfo.editProfileLink",
UI.getEditUserProfilePageURL())); LoginServlet.getEditUserProfilePageURL()));
list.add(new DynamicLink("login.userInfo.changePasswordLink", list.add(new DynamicLink("login.userInfo.changePasswordLink",
UI.getRecoverPasswordPageURL())); LoginServlet.getRecoverPasswordPageURL()));
add(list); add(list);
// add user info text // add user info text
@ -111,7 +110,7 @@ public class UserInfo extends SimpleContainer {
objectType = null; objectType = null;
} }
// If application type CMS Workspace is installed: // If application type Content-Center (CMS Workspace) is installed:
if (objectType != null) { if (objectType != null) {
// retrieve all packages of type content-center // retrieve all packages of type content-center
// works because there may be only one. // works because there may be only one.
@ -120,7 +119,7 @@ public class UserInfo extends SimpleContainer {
// step through collection of instances of type Workspace // step through collection of instances of type Workspace
// generally there is only a single instance, but obviously // generally there is only a single instance, but obviously
// code takes care provided therfe is an instance for // code takes care provided there is an instance for
// each subsite. // each subsite.
while (workspaceInstances.next()) { while (workspaceInstances.next()) {
// retrieve one Workspace instance of collection // retrieve one Workspace instance of collection

View File

@ -206,6 +206,11 @@ public class UserLoginForm extends Form
add(m_loginName); add(m_loginName);
} }
/**
*
* @param event
* @throws FormProcessException
*/
public void init(FormSectionEvent event) public void init(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
s_log.info("In init"); s_log.info("In init");
@ -234,6 +239,11 @@ public class UserLoginForm extends Form
} }
} }
/**
*
* @param event
* @throws FormProcessException
*/
public void validate(FormSectionEvent event) public void validate(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
@ -266,6 +276,11 @@ public class UserLoginForm extends Form
} }
} }
/**
*
* @param event
* @throws FormProcessException
*/
public void process(FormSectionEvent event) throws FormProcessException { public void process(FormSectionEvent event) throws FormProcessException {
s_log.debug("In process"); s_log.debug("In process");
@ -330,6 +345,12 @@ public class UserLoginForm extends Form
// do nothing // do nothing
} }
/**
*
* @param event
* @param e
* @throws FormProcessException
*/
protected void onBadPassword(FormSectionEvent event, protected void onBadPassword(FormSectionEvent event,
FailedLoginException e) FailedLoginException e)
throws FormProcessException { throws FormProcessException {

View File

@ -20,20 +20,20 @@ package com.arsdigita.web;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainServiceInterfaceExposer; // import com.arsdigita.domain.DomainServiceInterfaceExposer;
import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.ACSObject;
import com.arsdigita.kernel.Group; import com.arsdigita.kernel.Group;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; // import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.PackageInstance; // import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.PackageType; // import com.arsdigita.kernel.PackageType;
import com.arsdigita.kernel.Resource; import com.arsdigita.kernel.Resource;
import com.arsdigita.kernel.SiteNode; // import com.arsdigita.kernel.SiteNode;
import com.arsdigita.persistence.DataAssociation; // import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.persistence.DataAssociationCursor; // import com.arsdigita.persistence.DataAssociationCursor;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery; // import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -47,9 +47,9 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* <p>A base class for defining a web application. An application has * <p>A base class for defining a web application. </p>
* three important aspects:</p>
* *
* An application has three important aspects:
* <ol> * <ol>
* <li><em>Each is a data partition.</em> An application is like a * <li><em>Each is a data partition.</em> An application is like a
* folder: it contains a user-driven subset of the objects in the * folder: it contains a user-driven subset of the objects in the
@ -126,7 +126,7 @@ public class Application extends Resource {
if (Assert.isEnabled()) { if (Assert.isEnabled()) {
Assert.exists(type, ApplicationType.class); Assert.exists(type, ApplicationType.class);
Assert.exists(title, String.class); Assert.exists(title, String.class);
Assert.isTrue(type.m_legacyFree); // Assert.isTrue(type.m_legacyFree);
} }
return Application.make(type, null, title, null, createContainerGroup); return Application.make(type, null, title, null, createContainerGroup);
@ -220,15 +220,15 @@ public class Application extends Resource {
Assert.isTrue(!fragment.equals(""), Assert.isTrue(!fragment.equals(""),
"The URL fragment must not be the empty string"); "The URL fragment must not be the empty string");
} }
s_log.debug("Application type legacy free: " + type.m_legacyFree ); // s_log.debug("Application type legacy free: " + type.m_legacyFree );
if (type.m_legacyFree) { // if (type.m_legacyFree) {
return Application.make(type,fragment,title,parent, return Application.make(type,fragment,title,parent,
createContainerGroup); createContainerGroup);
} else { // } else {
s_log.debug("Creating legacy compatible app"); // s_log.debug("Creating legacy compatible app");
return Application.legacyMake(type,fragment,title,parent, // return Application.legacyMake(type,fragment,title,parent,
createContainerGroup); // createContainerGroup);
} // }
} }
/** /**
@ -287,17 +287,17 @@ public class Application extends Resource {
return app; return app;
} }
/** // /**
* Creates (makes) a legacy compatible application (using deprecated kernel // * Creates (makes) a legacy compatible application (using deprecated kernel
* packageType and sitenode stuff). // * packageType and sitenode stuff).
* @param type // * @param type
* @param fragment // * @param fragment
* @param title // * @param title
* @param parent // * @param parent
* @param createContainerGroup // * @param createContainerGroup
* @return // * @return
*/ // */
private static Application legacyMake(final ApplicationType type, /*private static Application legacyMake(final ApplicationType type,
final String fragment, final String fragment,
final String title, final String title,
final Application parent, final Application parent,
@ -343,7 +343,7 @@ public class Application extends Resource {
} }
return application; return application;
} } */
public static Application retrieveApplication(BigDecimal id) { public static Application retrieveApplication(BigDecimal id) {
OID oid = new OID(BASE_DATA_OBJECT_TYPE, id); OID oid = new OID(BASE_DATA_OBJECT_TYPE, id);
@ -385,14 +385,14 @@ public class Application extends Resource {
return (Application) result; return (Application) result;
} }
/** // /**
* // *
* Can return null. // * Can return null.
* @param siteNode // * @param siteNode
* @return // * @return
* @deprecated // * @ deprecated
*/ // */
public static Application retrieveApplicationForSiteNode /* public static Application retrieveApplicationForSiteNode
(SiteNode siteNode) { (SiteNode siteNode) {
DataQuery query = SessionManager.getSession().retrieveQuery DataQuery query = SessionManager.getSession().retrieveQuery
("com.arsdigita.web.applicationForSiteNodeID"); ("com.arsdigita.web.applicationForSiteNodeID");
@ -409,7 +409,7 @@ public class Application extends Resource {
query.close(); query.close();
return application; return application;
} } */
// Can return null. // Can return null.
public static Application retrieveApplicationForPath(String path) { public static Application retrieveApplicationForPath(String path) {
@ -452,13 +452,13 @@ public class Application extends Resource {
} }
// COMPAT XXX // COMPAT XXX
/** // /**
* @deprecated refactor not using deprecated class PackageType. Use // * @deprecated refactor not using deprecated class PackageType. Use
* ApplicationType instead // * ApplicationType instead
*/ // */
public PackageType getPackageType() { // public PackageType getPackageType() {
return getApplicationType().getPackageType(); // return getApplicationType().getPackageType();
} // }
// Can return null. // Can return null.
public Application getParentApplication() { public Application getParentApplication() {
@ -512,37 +512,37 @@ public class Application extends Resource {
return children; return children;
} }
/** // /**
* // *
* @return // * @return
* @deprecated refactor to use other methods of class aüpplication instead // * @deprecated refactor to use other methods of class aüpplication instead
*/ // */
private PackageInstance getPackageInstance() { /* private PackageInstance getPackageInstance() {
DataObject dataObject = (DataObject) get("packageInstance"); DataObject dataObject = (DataObject) get("packageInstance");
Assert.exists(dataObject, DataObject.class); Assert.exists(dataObject, DataObject.class);
return new PackageInstance(dataObject); return new PackageInstance(dataObject);
} } */
/** // /**
* // *
* @return // * @return
* @deprecated refactor to use other methods of class aüpplication instead // * @deprecated refactor to use other methods of class aüpplication instead
*/ // */
private void setPackageInstance(PackageInstance packageInstance) { /* private void setPackageInstance(PackageInstance packageInstance) {
Assert.exists(packageInstance, PackageInstance.class); Assert.exists(packageInstance, PackageInstance.class);
setAssociation("packageInstance", packageInstance); setAssociation("packageInstance", packageInstance);
} } */
/** // /**
* // *
* Needs to be getSiteNodes instead. // * Needs to be getSiteNodes instead.
* @return Can return null. // * @return Can return null.
* @deprecated // * @deprecated
*/ // */
public SiteNode getSiteNode() { /* public SiteNode getSiteNode() {
DataObject packageInstance = (DataObject)get("packageInstance"); DataObject packageInstance = (DataObject)get("packageInstance");
DataAssociation siteNodes = (DataAssociation)packageInstance.get DataAssociation siteNodes = (DataAssociation)packageInstance.get
@ -562,7 +562,7 @@ public class Application extends Resource {
} else { } else {
return new SiteNode(siteNode); return new SiteNode(siteNode);
} }
} } */
// Can return null. // Can return null.
/** /**
@ -649,7 +649,7 @@ public class Application extends Resource {
* in parallel we have to use a trailing slash for legacy free applications, * in parallel we have to use a trailing slash for legacy free applications,
* otherwise they will not be found by methods like retrieveApplicationForPath() * otherwise they will not be found by methods like retrieveApplicationForPath()
* which is called by legacy compatible apps including a trailing slash. If * which is called by legacy compatible apps including a trailing slash. If
* legacy free apps are store without trailing slash the search will never match. * legacy free apps are stored without trailing slash the search will never match.
*/ */
// Assert.isTrue // Assert.isTrue
// (path.equals("") || (path.startsWith(SLASH) // (path.equals("") || (path.startsWith(SLASH)
@ -722,7 +722,7 @@ public class Application extends Resource {
// //
// To support ACSObject services // To support ACSObject services
// //
private static SiteNode makeSiteNode(String urlName, Application parent) { /* private static SiteNode makeSiteNode(String urlName, Application parent) {
SiteNode siteNode; SiteNode siteNode;
if (parent == null) { if (parent == null) {
@ -738,7 +738,7 @@ public class Application extends Resource {
Assert.exists(siteNode, SiteNode.class); Assert.exists(siteNode, SiteNode.class);
return siteNode; return siteNode;
} } */
/** /**
* Returns a canonical application URL. This is a utility method * Returns a canonical application URL. This is a utility method
@ -814,10 +814,10 @@ public class Application extends Resource {
@Override @Override
public void beforeDelete() { public void beforeDelete() {
super.beforeDelete(); super.beforeDelete();
SiteNode node = getSiteNode(); // SiteNode node = getSiteNode();
if (node != null) { // if (node != null) {
node.delete(); // node.delete();
} // }
} }
@Override @Override
@ -867,8 +867,13 @@ public class Application extends Resource {
} }
// if application name changes, change name of container group /**
* .
*
* Note: If application name changes, change name of container group.
*
* @param title
*/
@Override @Override
public void setTitle (String title) { public void setTitle (String title) {
super.setTitle(title); super.setTitle(title);

View File

@ -20,7 +20,7 @@ package com.arsdigita.web;
import com.arsdigita.kernel.Group; import com.arsdigita.kernel.Group;
import com.arsdigita.kernel.ResourceType; import com.arsdigita.kernel.ResourceType;
import com.arsdigita.kernel.PackageType; // import com.arsdigita.kernel.PackageType;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
@ -29,7 +29,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataAssociationCursor;
import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.domain.DataObjectNotFoundException; // import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.db.Sequences; import com.arsdigita.db.Sequences;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -62,8 +62,8 @@ public class ApplicationType extends ResourceType {
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.web.ApplicationType"; "com.arsdigita.web.ApplicationType";
private PackageType m_packageType; // private PackageType m_packageType;
boolean m_legacyFree = false; boolean m_legacyFree = true;
/** /**
* Constructor creates a new ApplicationType instance to encapsulate a given * Constructor creates a new ApplicationType instance to encapsulate a given
@ -75,9 +75,9 @@ public class ApplicationType extends ResourceType {
*/ */
public ApplicationType(DataObject dataObject) { public ApplicationType(DataObject dataObject) {
super(dataObject); super(dataObject);
if (this.getPackageType() == null) { // indicates a legacy free app // if (this.getPackageType() == null) { // indicates a legacy free app
m_legacyFree = true; m_legacyFree = true;
} // otherwise leave it on its default value of false // } // otherwise leave it on its default value of false
} }
protected ApplicationType(String dataObjectType) { protected ApplicationType(String dataObjectType) {
@ -96,11 +96,11 @@ public class ApplicationType extends ResourceType {
final String applicationObjectType) { final String applicationObjectType) {
this(objectType, title, applicationObjectType, false); this(objectType, title, applicationObjectType, false);
// under some circumstances m_legacyFree is set correctly to true // under some circumstances m_legacyFree is set correctly to true
if (m_legacyFree == false) { //check if default value is correct! // if (m_legacyFree == false) { //check if default value is correct!
if (this.getPackageType() == null) { // indicates a legacy free app // if (this.getPackageType() == null) { // indicates a legacy free app
m_legacyFree = true; // m_legacyFree = true;
} // otherwise leave it on its default value of false // } // otherwise leave it on its default value of false
} // }
} }
@ -144,23 +144,23 @@ public class ApplicationType extends ResourceType {
// circumstances) // circumstances)
// Method overwrites a (overwritable) method provided by the super class to // Method overwrites a (overwritable) method provided by the super class to
// process a created (empty) data object. // process a created (empty) data object.
@Override // @Override
public void initialize() { // public void initialize() {
super.initialize(); // super.initialize();
s_log.debug("initialising application type "); // s_log.debug("initialising application type ");
if (!isNew() && getPackageType() == null) { // if (!isNew() && getPackageType() == null) {
s_log.debug("legacy free type"); // s_log.debug("legacy free type");
m_legacyFree = true; // m_legacyFree = true;
//
} // }
} // }
private void setDefaults() { private void setDefaults() {
// Defaults for standalone applications. // Defaults for standalone applications.
setFullPageView(true); // setFullPageView(true);
setEmbeddedView(false); // setEmbeddedView(false);
setWorkspaceApplication(true); // setWorkspaceApplication(true);
setSingleton(false); setSingleton(false);
} }
@ -175,142 +175,13 @@ public class ApplicationType extends ResourceType {
this(BASE_DATA_OBJECT_TYPE, title, applicationObjectType); this(BASE_DATA_OBJECT_TYPE, title, applicationObjectType);
} }
/**
* 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,
final String title,
final String applicationObjectType) {
this(dataObjectType, packageType, title, applicationObjectType, false);
}
/** /**
* Legacy compatible application type
* @param dataObjectType
* @param packageType
* @param title
* @param applicationObjectType
* @param createContainerGroup
* @deprecated without direct replacement. Refactor to legacy free app.
*/
protected ApplicationType(final String dataObjectType,
final PackageType packageType,
final String title,
final String applicationObjectType,
boolean createContainerGroup) {
this(dataObjectType);
Assert.exists(title, "title");
Assert.exists(applicationObjectType, "applicationObjectType");
Assert.exists(packageType, "packageType");
m_packageType = packageType;
setPackageType(m_packageType);
setTitle(title);
setApplicationObjectType(applicationObjectType);
setDefaults();
if (createContainerGroup) {
createGroup();
}
}
/**
* 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,
String applicationObjectType) {
return new ApplicationType
(BASE_DATA_OBJECT_TYPE, packageType, title, applicationObjectType);
}
/**
* Creates a legacy-compatible application type. The key
* 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) {
this(dataObjectType, makePackageType(key, title), title,
applicationObjectType);
}
/**
* Helper method to create a packageType for a new legacy compatible
* application type without an already existing (i.e. installed in db) legacy
* application.
* *
* @param key of the package to be created * @param id
* @param title of the package to be created
* @return * @return
* @deprecated without direct replacement. Refactor to legacy free app.
*/ */
private static PackageType makePackageType(String key, String title) {
PackageType packageType = new PackageType();
Assert.exists(key, "key");
Assert.exists(title, "title");
packageType.setKey(key);
packageType.setDisplayName(title);
packageType.setURI("http://arsdigita.com/" + key);
return packageType;
}
/**
* 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) {
return ApplicationType.createApplicationType(
key, title, applicationObjectType, false);
}
/**
* 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,
boolean createContainerGroup) {
// See if the package type is already present.
PackageType packageType = null;
try {
packageType = PackageType.findByKey(key);
return new ApplicationType
(BASE_DATA_OBJECT_TYPE, packageType, title,
applicationObjectType, createContainerGroup);
} catch (DataObjectNotFoundException nfe) {
return new ApplicationType
(BASE_DATA_OBJECT_TYPE, key, title, applicationObjectType);
}
}
// Param
public static ApplicationType retrieveApplicationType(BigDecimal id) { public static ApplicationType retrieveApplicationType(BigDecimal id) {
Assert.exists(id, "id"); Assert.exists(id, "id");
@ -371,65 +242,6 @@ public class ApplicationType extends ResourceType {
return new ApplicationTypeCollection(collection); return new ApplicationTypeCollection(collection);
} }
//
// Association properties (some by proxy)
//
/**
* Can return null.
* @return
* @deprecated without direct replacement. Refactor to legacy free app.
*/
public PackageType getPackageType() {
if (m_legacyFree == true) {
throw new UnsupportedOperationException
("This method is only supported for legacy application types");
}
final DataObject dataObject = (DataObject) get("packageType");
if (dataObject == null) {
return null;
} else {
return new PackageType(dataObject);
}
}
/**
* @deprecated with no replacement.
* @throws UnsupportedOperationException when this method is
* called for an application type without a corresponding package
* type.
*/
protected void setPackageType(PackageType packageType) {
if (m_legacyFree == true) {
throw new UnsupportedOperationException
("This method is only supported for legacy application types");
}
Assert.exists(packageType, "packageType");
setAssociation("packageType", packageType);
}
/**
* @deprecated with no replacement.
* @throws UnsupportedOperationException when this method is
* called for an application type without a corresponding package
* type.
*/
public void setDispatcherClass(String className) {
if (m_legacyFree == true) {
throw new UnsupportedOperationException
("This method is only supported for legacy application types");
}
if (m_packageType == null) {
m_packageType = getPackageType();
}
m_packageType.setDispatcherClass(className);
}
// //
// Member properties // Member properties
// //
@ -472,20 +284,20 @@ public class ApplicationType extends ResourceType {
return result.booleanValue(); return result.booleanValue();
} }
/** // /**
* @deprecated with no replacement. // * @deprecated with no replacement.
* @throws UnsupportedOperationException when this method is // * @throws UnsupportedOperationException when this method is
* called for an application type without a corresponding package // * called for an application type without a corresponding package
* type. // * type.
*/ // */
public void setWorkspaceApplication(boolean isWorkspaceApplication) { // public void setWorkspaceApplication(boolean isWorkspaceApplication) {
if (m_legacyFree == true) { // if (m_legacyFree == true) {
throw new UnsupportedOperationException // throw new UnsupportedOperationException
("This method is only supported for legacy application types"); // ("This method is only supported for legacy application types");
} // }
set("isWorkspaceApplication", new Boolean(isWorkspaceApplication)); // set("isWorkspaceApplication", new Boolean(isWorkspaceApplication));
} // }
public boolean hasFullPageView() { public boolean hasFullPageView() {
final Boolean result = (Boolean) get("hasFullPageView"); final Boolean result = (Boolean) get("hasFullPageView");
@ -495,46 +307,46 @@ public class ApplicationType extends ResourceType {
return result.booleanValue(); return result.booleanValue();
} }
/** // /**
* @deprecated with no replacement. // * @deprecated with no replacement.
* @throws UnsupportedOperationException when this method is // * @throws UnsupportedOperationException when this method is
* called for an application type without a corresponding package // * called for an application type without a corresponding package
* type. // * type.
*/ // */
protected void setFullPageView(boolean hasFullPageView) { // protected void setFullPageView(boolean hasFullPageView) {
if (m_legacyFree == true) { // if (m_legacyFree == true) {
throw new UnsupportedOperationException // throw new UnsupportedOperationException
("This method is only supported for legacy application types"); // ("This method is only supported for legacy application types");
} // }
set("hasFullPageView", new Boolean(hasFullPageView)); // set("hasFullPageView", new Boolean(hasFullPageView));
} // }
/** // /**
* @deprecated with no replacement. // * @deprecated with no replacement.
*/ // */
public boolean hasEmbeddedView() { // public boolean hasEmbeddedView() {
final Boolean result = (Boolean) get("hasEmbeddedView"); // final Boolean result = (Boolean) get("hasEmbeddedView");
Assert.exists(result, "Boolean result"); // Assert.exists(result, "Boolean result");
return result.booleanValue(); // return result.booleanValue();
} // }
/** // /**
* @deprecated with no replacement. // * @deprecated with no replacement.
* @throws UnsupportedOperationException when this method is // * @throws UnsupportedOperationException when this method is
* called for an application type without a corresponding package // * called for an application type without a corresponding package
* type. // * type.
*/ // */
protected void setEmbeddedView(boolean hasEmbeddedView) { // protected void setEmbeddedView(boolean hasEmbeddedView) {
if (m_legacyFree == true) { // if (m_legacyFree == true) {
throw new UnsupportedOperationException // throw new UnsupportedOperationException
("This method is only supported for legacy application types"); // ("This method is only supported for legacy application types");
} // }
set("hasEmbeddedView", new Boolean(hasEmbeddedView)); // set("hasEmbeddedView", new Boolean(hasEmbeddedView));
} // }
// Can return null. // Can return null.
public String getProfile() { public String getProfile() {
@ -596,6 +408,7 @@ public class ApplicationType extends ResourceType {
* <p>Remove an entry from the list of relevant privileges for * <p>Remove an entry from the list of relevant privileges for
* this ApplicationType.</p> * this ApplicationType.</p>
*/ */
@Override
public void removeRelevantPrivilege(PrivilegeDescriptor privilege) { public void removeRelevantPrivilege(PrivilegeDescriptor privilege) {
removeRelevantPrivilege(privilege.getName()); removeRelevantPrivilege(privilege.getName());
} }
@ -604,6 +417,7 @@ public class ApplicationType extends ResourceType {
* <p>Remove an entry from the list of relevant privileges for * <p>Remove an entry from the list of relevant privileges for
* this ApplicationType.</p> * this ApplicationType.</p>
*/ */
@Override
public void removeRelevantPrivilege(String privilegeName) { public void removeRelevantPrivilege(String privilegeName) {
OID privOID = new OID("com.arsdigita.kernel.permissions.Privilege", OID privOID = new OID("com.arsdigita.kernel.permissions.Privilege",
privilegeName); privilegeName);
@ -652,49 +466,49 @@ public class ApplicationType extends ResourceType {
// the class name without leading package name. // the class name without leading package name.
public String getName() { public String getName() {
if (m_legacyFree == true ) { // if (m_legacyFree == true ) {
s_log.debug("Expect XSL templates at " + StringUtils.urlize(getTitle())); s_log.debug("Expect XSL templates at " + StringUtils.urlize(getTitle()));
return StringUtils.urlize(getTitle()); return StringUtils.urlize(getTitle());
} else { // } else {
// m_legacyFree seems sometimes not set correctly! It's odd but the // m_legacyFree seems sometimes not set correctly! It's odd but the
// goal is to get rid of legacy code so it should do it for the // goal is to get rid of legacy code so it should do it for the
// time beeing. We check getPackageType to see if m_legacyFree is // time beeing. We svn rename check getPackageType to see if m_legacyFree is
// really set correctly. // really set correctly.
if (getPackageType() == null) { // indicates legacy free App // if (getPackageType() == null) { // indicates legacy free App
s_log.debug("Expect XSL templates at " // s_log.debug("Expect XSL templates at "
+ StringUtils.urlize(getTitle())); // + StringUtils.urlize(getTitle()));
m_legacyFree = true; // correct m_legacyFree for future use // m_legacyFree = true; // correct m_legacyFree for future use
return StringUtils.urlize(getTitle()); // return StringUtils.urlize(getTitle());
} else { // } else {
return this.getPackageType().getKey(); // return this.getPackageType().getKey();
} // }
} // }
} }
/** /**
* Declare this ApplicationType to be a singleton. That is to * Declare this ApplicationType to be a singleton. That is to
* say, there ought to only ever be one Application of this type * say, there ought to only ever be one Application of this type
* directly under a given Workspace. * directly under a given Workspace.
* @deprecated with no replacement. * @ deprecated with no replacement.
* @throws UnsupportedOperationException when this method is * @ throws UnsupportedOperationException when this method is
* called for an application type without a corresponding package * called for an application type without a corresponding package
* type. * type.
* Deprecated removed. Decided that also a new type app could be
* qualified as singleton. Specifically used in the planned app admin
* app.
*/ */
public void setSingleton(boolean isSingleton) { public void setSingleton(boolean isSingleton) {
if (m_legacyFree == true) {
throw new UnsupportedOperationException
("This method is only supported for legacy application types");
}
set("isSingleton", new Boolean(isSingleton)); set("isSingleton", new Boolean(isSingleton));
} }
/** /**
* Tell whether this ApplicationType is a singleton. * Tell whether this ApplicationType is a singleton.
* @deprecated with no replacement. * @ deprecated with no replacement.
*/ */
public boolean isSingleton() { public boolean isSingleton() {
final Boolean result = (Boolean) get("isSingleton"); final Boolean result = (Boolean) get("isSingleton");
Assert.exists(result, "Boolean result"); Assert.exists(result, "Boolean result");

View File

@ -21,15 +21,15 @@ package com.arsdigita.web;
import com.arsdigita.dispatcher.InitialRequestContext; import com.arsdigita.dispatcher.InitialRequestContext;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; // import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.SiteNode; // import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.KernelRequestContext; import com.arsdigita.kernel.KernelRequestContext;
import com.arsdigita.kernel.security.SessionContext; import com.arsdigita.kernel.security.SessionContext;
import com.arsdigita.kernel.security.UserContext; import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.sitenode.SiteNodeRequestContext; // import com.arsdigita.sitenode.SiteNodeRequestContext;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException; // import com.arsdigita.util.UncheckedWrapperException;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -212,27 +212,31 @@ public abstract class BaseApplicationServlet extends BaseServlet {
final KernelRequestContext krc = new KernelRequestContext final KernelRequestContext krc = new KernelRequestContext
(irc, sc, uc); (irc, sc, uc);
// SiteNode node = null;
// Experimental:
// if (node == null) {
// return krc;
// }
SiteNode node = null; // try {
try { // node = SiteNode.getSiteNode(app.getPrimaryURL(),
node = SiteNode.getSiteNode(app.getPrimaryURL(), // true);
true); // } catch (DataObjectNotFoundException ex) {
} catch (DataObjectNotFoundException ex) { // throw new UncheckedWrapperException("cannot find root sitenode");
throw new UncheckedWrapperException("cannot find root sitenode"); // }
}
if (node == null) { // if (node == null) {
s_log.debug("There is no site node at this URL; storing a " + // s_log.debug("There is no site node at this URL; storing a " +
"KernelRequestContext"); // "KernelRequestContext");
return krc; return krc;
} else { // } else {
s_log.debug("Creating a SiteNodeRequestContext"); // s_log.debug("Creating a SiteNodeRequestContext");
final SiteNodeRequestContext snrc = new SiteNodeRequestContext // final SiteNodeRequestContext snrc = new SiteNodeRequestContext
(sreq, krc, node, sreq.getServletPath() + "/"); // (sreq, krc, node, sreq.getServletPath() + "/");
return snrc; // return snrc;
} // }
} }
} }

View File

@ -43,6 +43,7 @@ import org.apache.log4j.Logger;
*/ */
public abstract class BaseJSP extends BaseServlet implements HttpJspPage { public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
/** A logger instance, primarily to assist debugging . */
private static Logger s_log = Logger.getLogger(BaseJSP.class); private static Logger s_log = Logger.getLogger(BaseJSP.class);
/** /**
@ -53,6 +54,7 @@ public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
* @see com.arsdigita.web.BaseServlet * @see com.arsdigita.web.BaseServlet
* @see com.arsdigita.web.BaseServlet#doService(HttpServletRequest,HttpServletResponse) * @see com.arsdigita.web.BaseServlet#doService(HttpServletRequest,HttpServletResponse)
*/ */
@Override
protected final void doService(final HttpServletRequest sreq, protected final void doService(final HttpServletRequest sreq,
final HttpServletResponse sresp) final HttpServletResponse sresp)
throws ServletException, IOException { throws ServletException, IOException {

View File

@ -27,7 +27,6 @@ import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.security.UserContext; import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.sitenode.ServletErrorReport;
import com.arsdigita.util.ResourceManager; import com.arsdigita.util.ResourceManager;
import java.io.IOException; import java.io.IOException;
@ -168,9 +167,8 @@ public abstract class BaseServlet extends HttpServlet {
// Now we're ready to service the request. // Now we're ready to service the request.
/* call flushAll on all non error paths so listeners /* call flushAll on all non error paths so listeners *
* run in correct context (bug 108499) * run in correct context (bug 108499) */
*/
try { try {
DeveloperSupport.startStage("BaseServlet.doService"); DeveloperSupport.startStage("BaseServlet.doService");
@ -309,6 +307,13 @@ public abstract class BaseServlet extends HttpServlet {
} }
} }
/**
*
* @param sresp
* @param transaction
* @param rs
* @throws IOException
*/
private void redirect(final HttpServletResponse sresp, private void redirect(final HttpServletResponse sresp,
final DatabaseTransaction transaction, final DatabaseTransaction transaction,
final RedirectSignal rs) final RedirectSignal rs)
@ -330,6 +335,12 @@ public abstract class BaseServlet extends HttpServlet {
sresp.sendRedirect(url); sresp.sendRedirect(url);
} }
/**
*
* @param sreq
* @return
*/
private URL getRequestURL(HttpServletRequest sreq) { private URL getRequestURL(HttpServletRequest sreq) {
URL url = (URL) sreq.getAttribute(REQUEST_URL_ATTRIBUTE); URL url = (URL) sreq.getAttribute(REQUEST_URL_ATTRIBUTE);

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.sitenode; package com.arsdigita.web;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Party;

View File

@ -1,12 +1,23 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
<jsp:directive.page import="com.arsdigita.ui.UI"/> <jsp:directive.page import="com.arsdigita.ui.UI"/>
<jsp:directive.page import="com.arsdigita.web.Web"/>
<jsp:directive.page import="com.arsdigita.web.WebContext"/>
<jsp:directive.page import="com.arsdigita.web.URL"/> <jsp:directive.page import="com.arsdigita.web.URL"/>
<jsp:directive.page import="com.arsdigita.web.RedirectSignal"/> <jsp:directive.page import="com.arsdigita.web.RedirectSignal"/>
<jsp:directive.page extends="com.arsdigita.web.BaseJSP"/> <jsp:directive.page extends="com.arsdigita.web.BaseJSP"/>
<jsp:scriptlet> <jsp:scriptlet>
// throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)),
// false);
if (Web.getContext().getUser() == null) {
// User not logged in, display public front page
throw new RedirectSignal(URL.there(request,UI.getWorkspaceURL(request)),
false);
} else {
// User logged in, redirect to user redirect page
throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)), throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)),
false); false);
}
</jsp:scriptlet> </jsp:scriptlet>
</jsp:root> </jsp:root>