ccm-portalworkspace umgestellt auf legacy-free application type.

Damit entfallen Einträge in apm_package* und site_node samt den entsprechenden
Klassen. Und weil es, nachdem verschiedene Probleme in core gefixt waren, so
schön einfach ging, auch gleich themedirector umgestellt.

In beiden Fällen update script erforderlich:
ccm-portalworkspace  6.6.1-6.6.2
ccm-themedirector 6.6.1-6.6.2

Es müssen dann lediglich die jar-files ausgetauscht werden und das 
Basisverzeichnis für das fallback theme (in themes/heirloon/apps bzw. noch
__ccm__/apps) in portal-workspace bzw. theme-director umbenannt werden.

Der Großteil der Applicationen ließe sich jetzt mit ein paar Zeilen
Codeänderung umstellen.


git-svn-id: https://svn.libreccm.org/ccm/trunk@829 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-04-05 08:15:12 +00:00
parent 580e2d90fb
commit 8aca4315bd
36 changed files with 472 additions and 102 deletions

View File

@ -24,8 +24,12 @@ model com.arsdigita.web;
// @author Justin Ross (justin@arsdigita.com) // @author Justin Ross (justin@arsdigita.com)
// @version $Id: WebApp.pdl 287 2005-02-22 00:29:02Z sskracic $ // @version $Id: WebApp.pdl 287 2005-02-22 00:29:02Z sskracic $
// Class WebApp seems to be quit unfinisched work and is commented out.
// So we need no table for it.
// We leave igt hefre vofr further reference.
// pboy April 2011
object type WebApp { object type WebApp {
String[1..1] name = webapps.name VARCHAR(200); // String[1..1] name = webapps.name VARCHAR(200);
object key (name); // object key (name);
} }

View File

@ -44,7 +44,7 @@ import com.arsdigita.ui.sitemap.SiteMap;
import com.arsdigita.util.URLRewriter; import com.arsdigita.util.URLRewriter;
import com.arsdigita.xml.FactoriesSetup; import com.arsdigita.xml.FactoriesSetup;
import com.arsdigita.web.Host; import com.arsdigita.web.Host;
import com.arsdigita.web.WebApp; // import com.arsdigita.web.WebApp;
import com.arsdigita.web.ApplicationType; import com.arsdigita.web.ApplicationType;
import com.arsdigita.workflow.simple.TaskComment; import com.arsdigita.workflow.simple.TaskComment;
import com.arsdigita.search.converter.Converter; import com.arsdigita.search.converter.Converter;
@ -94,8 +94,6 @@ public class Initializer extends CompoundInitializer {
add(new com.arsdigita.search.intermedia.Initializer()); add(new com.arsdigita.search.intermedia.Initializer());
add(new com.arsdigita.notification.Initializer()); add(new com.arsdigita.notification.Initializer());
// add(new LegacyInitializer("com/arsdigita/core/enterprise.init"));
// add(new OptionalLegacyInitializer("enterprise.init"));
} }
/** /**
@ -126,6 +124,7 @@ public class Initializer extends CompoundInitializer {
} }
}); });
/* Status Experimental - not used anywhere in code base.
e.getFactory().registerInstantiator e.getFactory().registerInstantiator
(WebApp.BASE_DATA_OBJECT_TYPE, (WebApp.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() { new DomainObjectInstantiator() {
@ -133,7 +132,7 @@ public class Initializer extends CompoundInitializer {
return new WebApp(data); return new WebApp(data);
} }
}); });
*/
e.getFactory().registerInstantiator e.getFactory().registerInstantiator
(TaskComment.BASE_DATA_OBJECT_TYPE, (TaskComment.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() { new DomainObjectInstantiator() {
@ -145,6 +144,7 @@ public class Initializer extends CompoundInitializer {
e.getFactory().registerInstantiator e.getFactory().registerInstantiator
(Admin.BASE_DATA_OBJECT_TYPE, (Admin.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(final DataObject data) { public DomainObject doNewInstance(final DataObject data) {
return new Admin(data); return new Admin(data);
} }
@ -153,6 +153,7 @@ public class Initializer extends CompoundInitializer {
e.getFactory().registerInstantiator e.getFactory().registerInstantiator
(SiteMap.BASE_DATA_OBJECT_TYPE, (SiteMap.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() { new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(final DataObject data) { public DomainObject doNewInstance(final DataObject data) {
return new SiteMap(data); return new SiteMap(data);
} }
@ -192,6 +193,7 @@ public class Initializer extends CompoundInitializer {
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new MimeType(dataObject); return new MimeType(dataObject);
} }
@Override
public DomainObjectInstantiator public DomainObjectInstantiator
resolveInstantiator(DataObject obj) { resolveInstantiator(DataObject obj) {
return this; return this;

View File

@ -111,6 +111,7 @@ public class Resource extends ACSObject {
return resource; return resource;
} }
@Override
protected void beforeSave() { protected void beforeSave() {
if (isNew() || isPropertyModified("parentResource")) { if (isNew() || isPropertyModified("parentResource")) {
m_parentModified = true; m_parentModified = true;
@ -123,6 +124,7 @@ public class Resource extends ACSObject {
} }
} }
@Override
protected void afterSave() { protected void afterSave() {
super.afterSave(); super.afterSave();

View File

@ -33,7 +33,9 @@ public class ApplicationOIDPatternGenerator implements PatternGenerator {
public String[] generateValues(String key, public String[] generateValues(String key,
HttpServletRequest req) { HttpServletRequest req) {
Application application = Web.getContext().getApplication();
final Application application = Web.getContext().getApplication();
if (application != null) { if (application != null) {
String[] oid = new String[1]; String[] oid = new String[1];
// FR: better URLEncode this // FR: better URLEncode this

View File

@ -28,6 +28,8 @@ import com.arsdigita.web.Application;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
/** /**
@ -35,16 +37,34 @@ import javax.servlet.http.HttpServletRequest;
* key, eg content-center, content-section. * key, eg content-center, content-section.
*/ */
public class ApplicationPatternGenerator implements PatternGenerator { public class ApplicationPatternGenerator implements PatternGenerator {
/** Private logger instance for debugging purpose */
private static final Logger s_log = Logger.getLogger(PatternGenerator.class);
/**
* Implementation iof the Interface class.
*
* @param key
* @param req
* @return
*/
public String[] generateValues(String key, public String[] generateValues(String key,
HttpServletRequest req) { HttpServletRequest req) {
final Application app = Web.getContext().getApplication(); final Application app = Web.getContext().getApplication();
if (app != null) { if (app != null) {
return new String[] { return new String[] {
app.getPackageType().getKey() app.getApplicationType().getName()
}; };
} }
// SiteNodeRequestContext is deprecated and replaced by web.WebContext
// used in the code above (Web.getContext().
// This code should never be executed.
s_log.error("Application not found in WebApplication context!");
SiteNodeRequestContext ctx = (SiteNodeRequestContext) SiteNodeRequestContext ctx = (SiteNodeRequestContext)
DispatcherHelper.getRequestContext(req); DispatcherHelper.getRequestContext(req);

View File

@ -22,8 +22,8 @@ import com.arsdigita.kernel.Kernel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* Generates a pattern for based on the request negotiated * Generates a pattern based on the request negotiated locale
* locale in com.arsdigita.kernel.KernelContext * in com.arsdigita.kernel.KernelContext
*/ */
public class LocalePatternGenerator implements PatternGenerator { public class LocalePatternGenerator implements PatternGenerator {
public String[] generateValues(String key, public String[] generateValues(String key,

View File

@ -115,9 +115,12 @@ import org.apache.log4j.Logger;
* @author Richard W.M. Jones * @author Richard W.M. Jones
*/ */
public class PatternStylesheetResolver implements StylesheetResolver { public class PatternStylesheetResolver implements StylesheetResolver {
/** Logger instance for debugging. */
private static final Logger s_log = Logger.getLogger private static final Logger s_log = Logger.getLogger
(PatternStylesheetResolver.class); (PatternStylesheetResolver.class);
/** List of registered pattern generators which are queried in turn. */
private static final HashMap s_generators = new HashMap(); private static final HashMap s_generators = new HashMap();
/** /**

View File

@ -22,15 +22,12 @@ import java.net.URL;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* The various <code>PresentationManager</code> classes resolve * The various <code>PresentationManager</code> classes resolve requests
* requests into stylesheets using classes derived from this * into stylesheets using classes derived from this interface.
* interface. *
* @version $Id: StylesheetResolver.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public interface StylesheetResolver { public interface StylesheetResolver {
public static final String versionId =
"$Id: StylesheetResolver.java 287 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/16 18:10:38 $";
/** /**
* Resolves a template for the request. * Resolves a template for the request.

View File

@ -33,8 +33,8 @@ import org.apache.log4j.Logger;
/** /**
* Generates a set of pattern values based on the URL path * Generates a set of pattern values based on the URL path info
* info for the current request. Slashes in the request are * for the current request. Slashes in the request are
* translated into hyphens; the file extension is stripped; * translated into hyphens; the file extension is stripped;
* the any 'index' is removed, except for the top level. * the any 'index' is removed, except for the top level.
* *
@ -140,7 +140,7 @@ public class URLPatternGenerator implements PatternGenerator {
return url.substring(base.length()-1); return url.substring(base.length()-1);
} }
// XXX fix me, why vcan't we get this from Web.getConfig.getRequestURL // XXX fix me, why can't we get this from Web.getConfig.getRequestURL
private String getBasePath() { private String getBasePath() {
SiteNodeRequestContext ctx = (SiteNodeRequestContext) SiteNodeRequestContext ctx = (SiteNodeRequestContext)
DispatcherHelper.getRequestContext(Web.getRequest()); DispatcherHelper.getRequestContext(Web.getRequest());

View File

@ -74,7 +74,9 @@ import org.apache.log4j.Logger;
*/ */
public class Application extends Resource { public class Application extends Resource {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(Application.class); private static final Logger s_log = Logger.getLogger(Application.class);
public static final String PRIMARY_URL = "primaryURL"; public static final String PRIMARY_URL = "primaryURL";
private static final String SLASH = "/"; private static final String SLASH = "/";
@ -215,7 +217,7 @@ 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 );
if (type.m_legacyFree) { if (type.m_legacyFree) {
return Application.make(type,fragment,title,parent,createContainerGroup); return Application.make(type,fragment,title,parent,createContainerGroup);
} else { } else {
@ -250,14 +252,29 @@ public class Application extends Resource {
"slashes; I got '" + fragment + "'"); "slashes; I got '" + fragment + "'");
} }
/* Problem with "slash or not slash"
* String fragment (=url) is expected without any slash, just the name.
* Given the original code below the fragment appears in database as
* "/[fragment]" but all of the other code expects "/[fragment]/" and
* all other applications created as legacy compatible have a trailing
* slash!
* So I experimentally changed the code to have a trailing slash.
* Because no other code uses legacy free applications I suppose the
* original code here is less tested.
* pboy April 2011 see method setPath() as well!
*/
if (parent == null) { if (parent == null) {
if (fragment == null) { if (fragment == null) {
app.setPath(""); // app.setPath(""); original code modified see above
app.setPath(SLASH);
} else { } else {
app.setPath(SLASH + fragment); // app.setPath(SLASH + fragment); original code modified see above
app.setPath(SLASH + fragment + SLASH);
} }
} else { } else {
app.setPath(parent.getPath() + SLASH + fragment); // app.setPath(parent.getPath() + SLASH + fragment); original code
// modified see above
app.setPath(parent.getPath() + SLASH + fragment + SLASH);
} }
return app; return app;
@ -276,14 +293,14 @@ public class Application extends Resource {
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,
final boolean createContainerGroup) { final boolean createContainerGroup) {
final Application application = (Application) Resource.createResource( final Application application = (Application) Resource.createResource(
type, title, parent); type, title, parent);
if (createContainerGroup) { if (createContainerGroup) {
s_log.debug("Creating Group for application"); s_log.debug("Creating Group for application");
application.createGroup(); application.createGroup();
} }
final DataObject dataObject = final DataObject dataObject =
DomainServiceInterfaceExposer.getDataObject(application); DomainServiceInterfaceExposer.getDataObject(application);
@ -382,6 +399,8 @@ public class Application extends Resource {
// Can return null. // Can return null.
public static Application retrieveApplicationForPath(String path) { public static Application retrieveApplicationForPath(String path) {
s_log.debug("retrieveApplicationForPath: " + path);
DataCollection dataCollection = DataCollection dataCollection =
SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
@ -392,6 +411,7 @@ public class Application extends Resource {
dataCollection.close(); dataCollection.close();
return Application.retrieveApplication(dataObject); return Application.retrieveApplication(dataObject);
} else { } else {
s_log.debug("retrieveApplicationForPath: No application found on " + path);
return null; return null;
} }
} }
@ -577,13 +597,24 @@ public class Application extends Resource {
public final void setPath(String path) { public final void setPath(String path) {
if (Assert.isEnabled()) { if (Assert.isEnabled()) {
Assert.exists(path, String.class); Assert.exists(path, String.class);
Assert.isTrue /* Modified by pboy April 2011
(path.equals("") || (path.startsWith(SLASH) * This Assert statement prevents a trailing slash. setPath is currently called
&& !path.endsWith(SLASH)), * only by Applicatiom#make which creates a LEGACY FREE application.
"The path must either be the empty string (for the " + * Legacy compatible applications are currently created WITH a trailing slash
"default application) or it must start with '/' and *not* " + * (see e.g. SiteNode#setURL oder SiteNode#getURLFromParent.) Therefore for the
"end in '/'; I got '" + path + "'"); * time beeing if we must support legacy free and legacy compatible applications
} * in parallel we have to use a trailing slash for legacy free applications,
* otherwise they will not be found by methods like retrieveApplicationForPath()
* 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.
*/
// Assert.isTrue
// (path.equals("") || (path.startsWith(SLASH)
// && !path.endsWith(SLASH)),
// "The path must either be the empty string (for the " +
// "default application) or it must start with '/' and *not* " +
// "end in '/'; I got '" + path + "'");
}
set(PRIMARY_URL, path); set(PRIMARY_URL, path);
} }

View File

@ -33,6 +33,8 @@ 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;
import com.arsdigita.util.StringUtils;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Collection; import java.util.Collection;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -95,9 +97,9 @@ public class ApplicationType extends ResourceType {
* @param createContainerGroup * @param createContainerGroup
*/ */
protected ApplicationType(final String objectType, protected ApplicationType(final String objectType,
final String title, final String title,
final String applicationObjectType, final String applicationObjectType,
final boolean createContainerGroup) { final boolean createContainerGroup) {
this(objectType); // creates and returns an empty data object this(objectType); // creates and returns an empty data object
Assert.exists(title, "String title"); Assert.exists(title, "String title");
@ -107,12 +109,13 @@ public class ApplicationType extends ResourceType {
setApplicationObjectType(applicationObjectType); setApplicationObjectType(applicationObjectType);
setDefaults(); setDefaults();
if (createContainerGroup) { if (createContainerGroup) {
createGroup(); createGroup();
} }
m_legacyFree = true; m_legacyFree = true;
} }
@Override
protected String getBaseDataObjectType() { protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE; return BASE_DATA_OBJECT_TYPE;
} }
@ -169,11 +172,19 @@ public class ApplicationType extends ResourceType {
} }
/**
* Legacy compatible application type
* @param dataObjectType
* @param packageType
* @param title
* @param applicationObjectType
* @param createContainerGroup
*/
protected ApplicationType(final String dataObjectType, protected ApplicationType(final String dataObjectType,
final PackageType packageType, final PackageType packageType,
final String title, final String title,
final String applicationObjectType, final String applicationObjectType,
boolean createContainerGroup) { boolean createContainerGroup) {
this(dataObjectType); this(dataObjectType);
Assert.exists(title, "title"); Assert.exists(title, "title");
@ -187,9 +198,9 @@ public class ApplicationType extends ResourceType {
setApplicationObjectType(applicationObjectType); setApplicationObjectType(applicationObjectType);
setDefaults(); setDefaults();
if (createContainerGroup) { if (createContainerGroup) {
createGroup(); createGroup();
} }
} }
/** /**
@ -561,6 +572,12 @@ public class ApplicationType extends ResourceType {
remove("relevantPrivileges", privDO); remove("relevantPrivileges", privDO);
} }
/**
* Retrieve the attribute object type from database, which is the fully
* qualified classname of the applications domain class.
*
* @return object typ (fully qualified classname) as string
*/
public String getApplicationObjectType() { public String getApplicationObjectType() {
String objectType = (String)get("objectType"); String objectType = (String)get("objectType");
@ -575,6 +592,38 @@ public class ApplicationType extends ResourceType {
set("objectType", objectType); set("objectType", objectType);
} }
/**
* Provides an "urlized" name for an application, especially needed by
* PatternStyleSheetResolver to locate the xsl templates for an application
* in the local file system tree.
*
* We use the developer provided title value as name stripping off all white
* spaces. So developer has some influence on the term.
*
* The name may not be unique! Uniqueness is by no way technically
* guaranteed! This is developer's responsibility.
*
* This method has been added to enable legacy-free types of applications to
* work in CCM. Class ApplicationType is meant to replace the deprecated
* class PackageType which provide this facility by its packageKey property.
* So wwe have to provide this functionality by ApplicationType as well
* which has no kind of "key" by design.
*/
public String getName() {
// m_legacyFree seems sometimes not set correctly!
// if (m_legacyFree == true ) {
if (getPackageType() == null) { // indicates a legacy free ApplicationType
// XXX we need a better way to determine a name, probably using
// the class name without leading package name.
s_log.debug("Expect XSL templates at " + StringUtils.urlize(getTitle()));
return StringUtils.urlize(getTitle());
} else {
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

View File

@ -81,7 +81,7 @@ public class Web {
* *
* @return A <code>WebContext</code> object; it cannot be null * @return A <code>WebContext</code> object; it cannot be null
*/ */
public static final WebContext getContext() { public static WebContext getContext() {
if (s_context == null) { if (s_context == null) {
s_context = new WebContextLocal(); s_context = new WebContextLocal();
} }
@ -94,7 +94,7 @@ public class Web {
* @return A <code>WebConfig</code> configuration record; it * @return A <code>WebConfig</code> configuration record; it
* cannot be null * cannot be null
*/ */
public static final WebConfig getConfig() { public static WebConfig getConfig() {
if (s_config == null) { if (s_config == null) {
s_config = new WebConfig(); s_config = new WebConfig();
s_config.require("ccm-core/web.properties"); s_config.require("ccm-core/web.properties");
@ -108,7 +108,7 @@ public class Web {
* @return The current <code>HttpServletRequest</code>; it can be * @return The current <code>HttpServletRequest</code>; it can be
* null * null
*/ */
public static final HttpServletRequest getRequest() { public static HttpServletRequest getRequest() {
return (HttpServletRequest) s_request.get(); return (HttpServletRequest) s_request.get();
} }

View File

@ -18,7 +18,7 @@
*/ */
package com.arsdigita.web; package com.arsdigita.web;
import com.arsdigita.web.Application; // import com.arsdigita.web.Application;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.kernel.security.UserContext; import com.arsdigita.kernel.security.UserContext;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -39,17 +39,22 @@ import org.apache.log4j.Logger;
*/ */
public final class WebContext extends Record { public final class WebContext extends Record {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(WebContext.class); private static final Logger s_log = Logger.getLogger(WebContext.class);
private Application m_application = null; private Application m_application = null;
private URL m_requestURL = null; private URL m_requestURL = null;
/** List of properties making up a Web Context */
private static String[] s_fields = new String[] { private static String[] s_fields = new String[] {
"User", "User",
"Application", "Application",
"RequestURL" "RequestURL"
}; };
/**
* Constructor
*/
WebContext() { WebContext() {
super(WebContext.class, s_log, s_fields); super(WebContext.class, s_log, s_fields);
} }

View File

@ -1,32 +1,19 @@
package com.arsdigita.london.navigation; package com.arsdigita.london.navigation;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.commons.cli.CommandLine;
import org.apache.log4j.Logger;
import com.arsdigita.categorization.Category;
import com.arsdigita.categorization.RootCategoryCollection;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.ui.role.RoleFactory;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObjectInstantiator; import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.Role;
import com.arsdigita.kernel.RoleCollection;
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
import com.arsdigita.london.terms.Domain; import com.arsdigita.london.terms.Domain;
import com.arsdigita.london.util.Program; import com.arsdigita.london.util.Program;
import com.arsdigita.london.util.Transaction; import com.arsdigita.london.util.Transaction;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import org.apache.commons.cli.CommandLine;
import org.apache.log4j.Logger;
public class AddNavigation extends Program { public class AddNavigation extends Program {
private static final Logger LOG = Logger.getLogger(AddNavigation.class); private static final Logger LOG = Logger.getLogger(AddNavigation.class);
@ -37,6 +24,7 @@ public class AddNavigation extends Program {
private void addNavigation(String navURL, String navTitle, String defaultDomain) { private void addNavigation(String navURL, String navTitle, String defaultDomain) {
if (!Application.isInstalled(Navigation.BASE_DATA_OBJECT_TYPE, "/"+navURL+"/")) { if (!Application.isInstalled(Navigation.BASE_DATA_OBJECT_TYPE, "/"+navURL+"/")) {
DomainObjectFactory.registerInstantiator( DomainObjectFactory.registerInstantiator(
Navigation.BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() { Navigation.BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {

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-portalworkspace" name="ccm-portalworkspace"
prettyName="Portal Workspace" prettyName="Portal Workspace"
version="6.6.1" version="6.6.2"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>

View File

@ -0,0 +1,44 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $Id: upd_system_tables.sql pboy $
-- adjust various system tables to the new name of application
update application_types
set title='Portal Workspace',
package_type_id=null
where object_type='com.arsdigita.portalworkspace.Workspace' ;
update applications
set package_id=null
where primary_url = '/portal/' ;
-- table site_nodes
delete from site_nodes
where name like '%portal%' ;
-- table apm_packages
delete from apm_packages
where pretty_name like '%Portal%' ;
-- table apm_package_types doesn't require an update
delete from apm_package_types
where pretty_name like '%Workspace%' ;

View File

@ -0,0 +1,22 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $DateTime: 2011/03/27 23:15:09 $
-- $Id: oracle-se-6.6.0-6.6.1 pboy $
@@ default/6.6.1-6.6.2/upd_system_tables.sql

View File

@ -0,0 +1,26 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $DateTime: 2010/11/10 23:15:09 $
\echo Red Hat Enterprise ccm-portalworkspace 6.6.0 -> 6.6.1 Upgrade Script (PostgreSQL)
begin;
\i default/6.6.1-6.6.2/upd_system_tables.sql
commit;

View File

@ -22,4 +22,7 @@
<version from="6.6.0" to="6.6.1"> <version from="6.6.0" to="6.6.1">
<script sql="ccm-portalworkspace/upgrade/::database::-6.6.0-6.6.1.sql"/> <script sql="ccm-portalworkspace/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version> </version>
<version from="6.6.1" to="6.6.2">
<script sql="ccm-portalworkspace/upgrade/::database::-6.6.1-6.6.2.sql"/>
</version>
</upgrade> </upgrade>

View File

@ -18,12 +18,13 @@
package com.arsdigita.portalworkspace; package com.arsdigita.portalworkspace;
import org.apache.log4j.Logger; // import com.arsdigita.domain.DomainObject;
// import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.ResourceType; import com.arsdigita.kernel.ResourceType;
import com.arsdigita.loader.PackageLoader; import com.arsdigita.loader.PackageLoader;
// import com.arsdigita.persistence.DataObject;
import com.arsdigita.portalworkspace.portlet.ApplicationDirectoryPortlet; import com.arsdigita.portalworkspace.portlet.ApplicationDirectoryPortlet;
import com.arsdigita.portalworkspace.portlet.ContentDirectoryPortlet; import com.arsdigita.portalworkspace.portlet.ContentDirectoryPortlet;
import com.arsdigita.portalworkspace.portlet.FreeformHTMLPortlet; import com.arsdigita.portalworkspace.portlet.FreeformHTMLPortlet;
@ -40,8 +41,11 @@ import com.arsdigita.util.parameter.BooleanParameter;
import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.StringParameter; import com.arsdigita.util.parameter.StringParameter;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
// import com.arsdigita.web.ApplicationSetup;
import com.arsdigita.web.ApplicationType; import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger;
/** /**
* Executes nonrecurring at install time and loads (and configures ) a default * Executes nonrecurring at install time and loads (and configures ) a default
* workspace instance (i.e. instance of ccm-portalworkspace) in a default * workspace instance (i.e. instance of ccm-portalworkspace) in a default
@ -86,7 +90,7 @@ public class Loader extends PackageLoader {
} }
/** /**
* Run script invoked by the loader script. * Run script invoked by com.arsdigita.packing loader script.
* *
* @param ctx * @param ctx
*/ */
@ -128,9 +132,9 @@ public class Loader extends PackageLoader {
if (url != null) { if (url != null) {
// check weather the url parameter is properly formatted // check weather the url parameter is properly formatted
s_log.debug("process url " + url); s_log.error("process url " + url);
Assert.isTrue(url.startsWith("/"), "url starts with /"); Assert.isTrue(url.startsWith("/"), "url starts not with /");
Assert.isTrue(url.endsWith("/"), "url ends with /"); Assert.isTrue(url.endsWith("/"), "url ends not with /");
Assert.isTrue(!url.equals("/"), "url is not /"); Assert.isTrue(!url.equals("/"), "url is not /");
int last = url.lastIndexOf("/", url.length() - 2); int last = url.lastIndexOf("/", url.length() - 2);
@ -145,36 +149,52 @@ public class Loader extends PackageLoader {
} else { } else {
name = url.substring(1, url.length() - 1); name = url.substring(1, url.length() - 1);
} }
s_log.debug("node name is " + name); s_log.error("node name is " + name);
// set up the portal node // set up the portal node
Workspace workspace = Workspace.createWorkspace(name, title, // Workspace workspace = Workspace.createWorkspace(name, title,
parent, Boolean.TRUE.equals(isPublic)); // parent, Boolean.TRUE.equals(isPublic));
Workspace workspace = Workspace.createWorkspace(type, name, title,
null, parent, Boolean.TRUE.equals(isPublic));
} }
} }
/** /**
* Creates a workspace application type as a legacy-compatible application * Creates a workspace application type as a legacy-free application type.
* type.
* *
* No localization here because it is an invariant configuration. * No localization here because it is an invariant configuration.
* *
* NOTE: The wording in the title parameter of ApplicationType determines
* the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and replacing
* blanks between words and illegal characters with an hyphen and converted
* to lower case.
* "Portal Workspace" will become "portal-workspace".
*
* Creates an entry in table application_types and a corresponding entry in * Creates an entry in table application_types and a corresponding entry in
* apm_package_types * apm_package_types
* *
* @return * @return
*/ */
private ApplicationType setupWorkspaceType() { private ApplicationType setupWorkspaceType() {
s_log.debug("Creating an application type for portal workspace. " +
"Base Data Object Type: " + Workspace.BASE_DATA_OBJECT_TYPE);
// The first string is a key parameter used to create a // The first string is a key parameter used to create a
// legacy package type to back the new application type. // legacy package type to back the new application type.
ApplicationType type = ApplicationType.createApplicationType( // ApplicationType type = ApplicationType.createApplicationType(
"portalworkspace", // "portalworkspace",
"Portal Workspace", // "Portal Workspace",
Workspace.BASE_DATA_OBJECT_TYPE); // Workspace.BASE_DATA_OBJECT_TYPE);
ApplicationType type = new ApplicationType( "Portal Workspace",
Workspace.BASE_DATA_OBJECT_TYPE );
type.setDescription("Portal based collaborative workspaces"); type.setDescription("Portal based collaborative workspaces");
type.createGroup(); type.createGroup();
return type; return type;
} }
/** /**
@ -182,6 +202,9 @@ public class Loader extends PackageLoader {
* *
* Creates an entry for class (=type) c.ad.portalworkspace.WorkspacePage in * Creates an entry for class (=type) c.ad.portalworkspace.WorkspacePage in
* table application_types, but not in apm_package_types. * table application_types, but not in apm_package_types.
*
* Uses the legacy free type of application Information (i.e. a title string
* and the object type = fully qualified domain class name) for creation
* @return * @return
*/ */
private ResourceType setupWorkspacePageType() { private ResourceType setupWorkspacePageType() {

View File

@ -45,6 +45,7 @@ import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
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.Web; import com.arsdigita.web.Web;
import java.util.Iterator; import java.util.Iterator;
@ -150,7 +151,8 @@ public class Workspace extends Application {
} }
/** /**
* Does the real work to create a workspace in the storage (db) * Does the real work to create a workspace as a legacy compatible
* applicationin the storage (db)
* *
* NOTE: Parameter isPublic may be a misnomer, the actual usage of it in the * NOTE: Parameter isPublic may be a misnomer, the actual usage of it in the
* process of application creation uses it as createGroupContainer * process of application creation uses it as createGroupContainer
@ -179,6 +181,39 @@ public class Workspace extends Application {
return workspace; return workspace;
} }
/**
* Does the real work to create a workspace as a legacy free application
* in the storage (db)
*
* NOTE: Parameter isPublic may be a misnomer, the actual usage of it in the
* process of application creation uses it as createGroupContainer
*
* @param url
* @param title
* @param layout
* @param parent
* @param isPublic whether to create a workspace group
* @return
*/
public static Workspace createWorkspace(ApplicationType type,
String url, String title,
PageLayout layout,
Application parent,
boolean isPublic) {
if (s_log.isDebugEnabled()) {
s_log.debug("Creating group workspace, isPublic:" + isPublic
+ " on " + url + " with parent "
+ (parent == null ? "none" : parent.getOID().toString()));
}
if (layout==null) layout = PageLayout.getDefaultLayout();
Workspace workspace = (Workspace) Application.createApplication(
type, url, title, parent, isPublic );
workspace.setupGroups(title, isPublic);
workspace.setDefaultLayout(layout);
return workspace;
}
/** /**
* Does the real work to create a workspace in the storage (db) * Does the real work to create a workspace in the storage (db)
* *

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-themedirector" name="ccm-themedirector"
prettyName="Theme Director" prettyName="Theme Director"
version="6.6.1" version="6.6.2"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>

View File

@ -0,0 +1,44 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $Id: upd_system_tables.sql pboy $
-- adjust various system tables to the new name of application
update application_types
set title='Theme Director',
package_type_id=null
where object_type='com.arsdigita.themedirector.ThemeDirector' ;
update applications
set package_id=null
where primary_url = '/admin/themes/' ;
-- table site_nodes
delete from site_nodes
where name like '%theme%' ;
-- table apm_packages
delete from apm_packages
where pretty_name like '%Theme%' ;
-- table apm_package_types doesn't require an update
delete from apm_package_types
where pretty_name like '%Theme%' ;

View File

@ -0,0 +1,22 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $DateTime: 2011/03/27 23:15:09 $
-- $Id: oracle-se-6.6.0-6.6.1 pboy $
@@ default/6.6.0-6.6.1/upd_theme_app_table.sql
@@ default/6.6.0-6.6.1/upd_system_tables.sql

View File

@ -0,0 +1,26 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $DateTime: 2010/11/10 23:15:09 $
\echo Red Hat Enterprise ccm-themedirector 6.6.0 -> 6.6.1 Upgrade Script (PostgreSQL)
begin;
\i default/6.6.1-6.6.2/upd_system_tables.sql
commit;

View File

@ -11,4 +11,7 @@
<version from="6.6.0" to="6.6.1"> <version from="6.6.0" to="6.6.1">
<script sql="ccm-themedirector/upgrade/::database::-6.6.0-6.6.1.sql"/> <script sql="ccm-themedirector/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version> </version>
<version from="6.6.1" to="6.6.2">
<script sql="ccm-themedirector/upgrade/::database::-6.6.1-6.6.2.sql"/>
</version>
</upgrade> </upgrade>

View File

@ -49,26 +49,45 @@ public class Loader extends PackageLoader implements ThemeDirectorConstants {
/** /**
* Creates theme manager as a legacy-compatible application type. * Creates theme manager as a legacy-free application type.
* *
* NOTE: The wording in the title parameter of ApplicationType determines
* the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and replacing
* blanks between words and illegal characters with an hyphen and converted
* to lower case.
* Example: "Theme Director" will become "theme-director".
*
* Creates an entry in table application_types and a corresponding entry in
* apm_package_types
*/ */
private void setupThemeDirector() { private void setupThemeDirector() {
// create application type // create application type
ApplicationType type = ApplicationType.createApplicationType( // legacy compatible style of creation
"themedirector", // ApplicationType type = ApplicationType.createApplicationType(
"CCM Themes Administration", // "themedirector",
ThemeDirector.BASE_DATA_OBJECT_TYPE); // "CCM Themes Administration",
// ThemeDirector.BASE_DATA_OBJECT_TYPE);
// EXPERIMENTAL legacy free style of creation
ApplicationType type =
new ApplicationType( "Theme Director",
ThemeDirector.BASE_DATA_OBJECT_TYPE );
type.setDescription("CCM themes administration"); type.setDescription("CCM themes administration");
Application admin = Application.retrieveApplicationForPath("/admin/"); Application admin = Application.retrieveApplicationForPath("/admin/");
// create application instance // create application instance as a legacy compatible app
// Whether a legacy compatible or a legacy free application is
// created depends on the type of ApplicationType above. No need to
// modify anything here
Application app = Application app =
Application.createApplication(type, Application.createApplication(type,
"themes", "themes",
"CCM Themes Administration", "CCM Themes Administration",
admin); admin);
app.setDescription("CCM themes administration"); app.setDescription("CCM themes administration");
} }
} }

View File

@ -31,10 +31,10 @@ public interface ThemeDirectorConstants {
/** Name of the directory for themes under development (sub-dir of THEMES_DIR) */ /** Name of the directory for themes under development (sub-dir of THEMES_DIR) */
public final static String DEV_DIR_STUB = "devel-themedir"; public final static String DEV_DIR_STUB = "devel-themedir";
public final static String PROD_THEMES_BASE_DIR = public final static String
THEMES_DIR + "/" + PROD_DIR_STUB+ "/"; PROD_THEMES_BASE_DIR = THEMES_DIR + "/" + PROD_DIR_STUB+ "/";
public final static String DEV_THEMES_BASE_DIR = public final static String
THEMES_DIR + "/" + DEV_DIR_STUB + "/"; DEV_THEMES_BASE_DIR = THEMES_DIR + "/" + DEV_DIR_STUB + "/";
// ccm-themedirector (formerly ccm-ldn-theme) is no longer installed in its // ccm-themedirector (formerly ccm-ldn-theme) is no longer installed in its
// own web context (ROOT or ccm-ldn-theme/ccm-themedirector) so it is not // own web context (ROOT or ccm-ldn-theme/ccm-themedirector) so it is not