Erster Teil Umstellung cms-workspace und cms-service auf new application type. Functional noch unverändert. Release um 1 erhöht.
git-svn-id: https://svn.libreccm.org/ccm/trunk@906 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f2387d424f
commit
dc0c1ceb6a
|
|
@ -2,7 +2,7 @@
|
|||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-cms"
|
||||
prettyName="Red Hat CCM Content Management System"
|
||||
version="6.6.1"
|
||||
version="6.6.2"
|
||||
release="1"
|
||||
webapp="ROOT">
|
||||
<ccm:dependencies>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Copyright (C) 2011 Peter Boy <pb@zes.uni-bremen.de> 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: Service.pdl pboy $
|
||||
model com.arsdigita.cms;
|
||||
|
||||
import com.arsdigita.kernel.*;
|
||||
import com.arsdigita.web.Application;
|
||||
|
||||
object type Service extends Application {
|
||||
// nothing to persist yet
|
||||
// reference key (cms_service.service_id);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Copyright (C) 2011 Peter Boy <pb@zes.uni-bremen.de> 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: Workspace.pdl pboy $
|
||||
model com.arsdigita.cms;
|
||||
|
||||
import com.arsdigita.kernel.*;
|
||||
import com.arsdigita.web.Application;
|
||||
|
||||
object type Workspace extends Application {
|
||||
// nothing to persist yet
|
||||
// reference key (cms_workspace.workspace_id);
|
||||
}
|
||||
|
|
@ -38,10 +38,14 @@
|
|||
</version>
|
||||
|
||||
<version from="6.6.0" to="6.6.1">
|
||||
<!--
|
||||
-->
|
||||
<script sql="ccm-cms/upgrade/::database::-6.6.0-6.6.1.sql"/>
|
||||
<script class="com.arsdigita.cms.upgrade.CreateGenericContentTypes"/>
|
||||
</version>
|
||||
<version from="6.6.1" to="6.6.2">
|
||||
<script class="com.arsdigita.cms.upgrade.AddNewStyleApplicationEntries"/>
|
||||
<!--
|
||||
<script sql="ccm-cms/upgrade/::database::-6.6.0-6.6.1.sql"/>
|
||||
-->
|
||||
</version>
|
||||
|
||||
</upgrade>
|
||||
|
|
|
|||
|
|
@ -127,12 +127,13 @@ public class Loader extends PackageLoader {
|
|||
"com.arsdigita.cms.dispatcher.ContentCenterDispatcher";
|
||||
// To be updated soon...
|
||||
// "com.arsdigita.dispatcher.DefaultPackageDispatcher";
|
||||
/**
|
||||
* Stylesheet which has to be assigned as part of a legacy application
|
||||
* creation.
|
||||
*/
|
||||
private final static String WORKSPACE_STYLESHEET =
|
||||
"/packages/content-section/xsl/content-center.xsl";
|
||||
|
||||
// /**
|
||||
// * Stylesheet which has to be assigned as part of a legacy application
|
||||
// * creation.
|
||||
// */
|
||||
// private final static String WORKSPACE_STYLESHEET =
|
||||
// "/packages/content-section/xsl/content-center.xsl";
|
||||
/**
|
||||
* Name of the CMS service package instance, i.e. its URL.
|
||||
*/
|
||||
|
|
@ -170,11 +171,11 @@ public class Loader extends PackageLoader {
|
|||
|
||||
// 2 - step 1b) Setup the Workspace package.
|
||||
loadWorkspacePackage(); // using old stype
|
||||
// loadWorkspacePackageNewStyle();
|
||||
// loadWorkspacePackageNewStyle(); // using new style
|
||||
|
||||
// 3 - step 1c) Setup the CMS global services package.
|
||||
loadServicePackage(); // using olde style
|
||||
// loadServicePackageNewStyle();
|
||||
// loadServicePackageNewStyle(); // using new style
|
||||
|
||||
// 4 - step 1d) Load the content-center page mappings
|
||||
// Wrong! Is Initializer task, must be done each startup, in
|
||||
|
|
@ -283,19 +284,6 @@ public class Loader extends PackageLoader {
|
|||
"Content Centers",
|
||||
"http://cms-workspace.arsdigita.com/");
|
||||
type.setDispatcherClass(WORKSPACE_DISPATCHER_CLASS);
|
||||
|
||||
// Register a stylesheet to the Content Center package.
|
||||
// Registering a Stylesheet referrs to the old LegacyStylesheetResolver
|
||||
// which uses a database entry to determine an appropriate stylesheet.
|
||||
// New way is a pattern based search algorithm. Preserved here for easy
|
||||
// reference during transition (removal of corresponding classes)
|
||||
// see com.arsdigita.templating
|
||||
// content center works without registering a style sheet here.
|
||||
// Stylesheet ss =
|
||||
// Stylesheet.createStylesheet(WORKSPACE_STYLESHEET);
|
||||
// ss.save();
|
||||
// type.addStylesheet(ss);
|
||||
|
||||
type.save();
|
||||
|
||||
// from PackageInstance instance = workspaceInstaller.createPackageInstance();
|
||||
|
|
@ -329,8 +317,8 @@ public class Loader extends PackageLoader {
|
|||
* Loads and instantiates the Workspace package (content-center) in the
|
||||
* database.
|
||||
*/
|
||||
private void loadWorkspacePackageNewStyle() {
|
||||
s_log.debug("Creating CMS Workspace...");
|
||||
public static ApplicationType loadWorkspaceApplicationType() {
|
||||
s_log.warn("Creating CMS Workspace...");
|
||||
|
||||
// Creating of Workspace package using new style c.ad.web.Application
|
||||
// in legacy compatible mode. Needs refactoring of the Workspace package.
|
||||
|
|
@ -358,15 +346,27 @@ public class Loader extends PackageLoader {
|
|||
|
||||
ApplicationType workspaceType = appsetup.run();
|
||||
workspaceType.save();
|
||||
s_log.warn("CMS Workspace type created.");
|
||||
|
||||
return workspaceType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param workspaceType
|
||||
*/
|
||||
public static void setupDefaultWorkspaceApplicationInstance(
|
||||
ApplicationType workspaceType) {
|
||||
// create legacy compatible application instance,
|
||||
// old-style package key used as url fragment where to install the instance
|
||||
s_log.warn("Creating CMS Workspace instance ...");
|
||||
Workspace app = (Workspace) Application.createApplication(
|
||||
workspaceType, // type
|
||||
Workspace.PACKAGE_KEY, // url fragment
|
||||
Workspace.INSTANCE_NAME,// title
|
||||
null); // parent
|
||||
app.save();
|
||||
s_log.warn("CMS Workspace instance created.");
|
||||
|
||||
s_log.debug("Done loading CMS Workspace.");
|
||||
}
|
||||
|
|
@ -411,7 +411,7 @@ public class Loader extends PackageLoader {
|
|||
* store for global resources and assets.
|
||||
*
|
||||
*/
|
||||
private void loadServicePackageNewStyle() {
|
||||
public static ApplicationType loadServiceApplicationType() {
|
||||
s_log.debug("Loading CMS Servce Package...");
|
||||
|
||||
|
||||
|
|
@ -429,8 +429,6 @@ public class Loader extends PackageLoader {
|
|||
// old style / legacy compatible properties
|
||||
appsetup.setKey(Service.PACKAGE_KEY);
|
||||
appsetup.setDispatcherClass(Service.DISPATCHER_CLASS);
|
||||
// Service has no UI, therefore no stylesheet available
|
||||
// appsetup.setStylesheet( Workspace.STYLESHEET );
|
||||
appsetup.setSingleton(true);
|
||||
appsetup.setPortalApplication(false);
|
||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||
|
|
@ -443,6 +441,16 @@ public class Loader extends PackageLoader {
|
|||
ApplicationType serviceType = appsetup.run();
|
||||
serviceType.save();
|
||||
|
||||
return serviceType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param serviceType
|
||||
*/
|
||||
public static void setupDefaultServiceApplicationInstance(
|
||||
ApplicationType serviceType) {
|
||||
// create legacy compatible application instance,
|
||||
// old-style package key used as url fragment where to install the instance
|
||||
Service app = (Service) Application.createApplication(
|
||||
|
|
|
|||
|
|
@ -43,8 +43,11 @@ public class Service extends Application {
|
|||
|
||||
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
||||
|
||||
// pdl stuff (constants)
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.Service";
|
||||
|
||||
// general constants
|
||||
public static final String PACKAGE_KEY = "cms-service";
|
||||
public static final String INSTANCE_NAME = "CMS Service";
|
||||
public static final String DISPATCHER_CLASS =
|
||||
|
|
@ -54,20 +57,57 @@ public class Service extends Application {
|
|||
// "/packages/content-section/xsl/content-center.xsl";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param oid
|
||||
* Constructor retrieving service from the database usings its OID.
|
||||
*
|
||||
* @param oid the OID of the service (cms-service)
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public Service(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor retrieving the contained <code>DataObject</code> from the
|
||||
* persistent storage mechanism with an <code>OID</code> specified by id.
|
||||
*
|
||||
* @param id The <code>id</code> for the retrieved
|
||||
* <code>DataObject</code>.
|
||||
*/
|
||||
public Service(BigDecimal key) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a service domain object from the underlying data object.
|
||||
*/
|
||||
public Service(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter to retrieve the base database object type name
|
||||
*
|
||||
* @return base data aoject type as String
|
||||
*/
|
||||
@Override
|
||||
protected String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when the application is created.
|
||||
*/
|
||||
public static Service create(String urlName,
|
||||
String title,
|
||||
Application parent) {
|
||||
|
||||
Service app = (Service) Application.createApplication
|
||||
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
|
||||
|
||||
app.save();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ package com.arsdigita.cms;
|
|||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.DataAssociation;
|
||||
import com.arsdigita.persistence.PersistenceException;
|
||||
// import com.arsdigita.persistence.DataAssociation;
|
||||
// import com.arsdigita.persistence.PersistenceException;
|
||||
import com.arsdigita.web.Application;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
// WORK IN PROGRESS !!
|
||||
|
||||
/**
|
||||
* Application domain class for the CMS module user entry page (content-center)
|
||||
|
|
@ -40,8 +41,11 @@ public class Workspace extends Application {
|
|||
|
||||
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
||||
|
||||
// pdl stuff (constants)
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.Workspace";
|
||||
|
||||
// general constants
|
||||
public static final String PACKAGE_KEY = "content-center";
|
||||
public static final String INSTANCE_NAME = "Content Center";
|
||||
public static final String DISPATCHER_CLASS =
|
||||
|
|
@ -50,20 +54,57 @@ public class Workspace extends Application {
|
|||
"/packages/content-section/xsl/content-center.xsl";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param oid
|
||||
* Constructor retrieving a workspace from the database usings its OID.
|
||||
*
|
||||
* @param oid the OID of the workspace (content-center)
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public Workspace(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor retrieving the contained <code>DataObject</code> from the
|
||||
* persistent storage mechanism with an <code>OID</code> specified by id.
|
||||
*
|
||||
* @param id The <code>id</code> for the retrieved
|
||||
* <code>DataObject</code>.
|
||||
*/
|
||||
public Workspace(BigDecimal key) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a repository from the underlying data object.
|
||||
*/
|
||||
public Workspace(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter to retrieve the base database object type name
|
||||
*
|
||||
* @return base data aoject type as String
|
||||
*/
|
||||
@Override
|
||||
protected String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when the application is created.
|
||||
*/
|
||||
public static Workspace create(String urlName,
|
||||
String title,
|
||||
Application parent) {
|
||||
|
||||
Workspace app =
|
||||
(Workspace) Application.createApplication
|
||||
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
|
||||
|
||||
app.save();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Peter Boy <pb@zes.uni-bremen.de>. 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.cms.upgrade;
|
||||
|
||||
import com.arsdigita.cms.Loader;
|
||||
import com.arsdigita.kernel.Group;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.kernel.PackageInstance;
|
||||
import com.arsdigita.kernel.PackageInstanceCollection;
|
||||
import com.arsdigita.kernel.PackageType;
|
||||
import com.arsdigita.kernel.Resource;
|
||||
import com.arsdigita.kernel.ResourceType;
|
||||
import com.arsdigita.packaging.Program;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.TransactionContext;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Update from CCM version 6.6.1 to 6.6.2 where loader has been refactored to
|
||||
* use (new style) applications in package com.arsdigita.weg instead of old
|
||||
* style applications using com.arsdigita.kermel.[Package* & SiteNode].
|
||||
*
|
||||
* Affected are the packages CMS Workspace and Service. They are now loaded
|
||||
* using new style application classes Workspace and Service.
|
||||
*
|
||||
* The task at hand is to add the necessary table entries for CMS Workspace and
|
||||
* Service to the tables application_types and applications using the
|
||||
* information already existing (by old style initialization) in
|
||||
* apm_package_types, site_nodes, and apm_packages.
|
||||
*
|
||||
* @author pb
|
||||
*/
|
||||
public class AddNewStyleApplicationEntries extends Program {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(CreateGenericContentTypes.class);
|
||||
|
||||
/**
|
||||
/* Constructor
|
||||
*/
|
||||
public AddNewStyleApplicationEntries() {
|
||||
super("AddNewStyleApplicationEntries", "1.0.0", "");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The mandatory main method
|
||||
* @param args
|
||||
*/
|
||||
public static void main(final String[] args) {
|
||||
new AddNewStyleApplicationEntries().run(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Worker method. Adds new style application entries.
|
||||
*
|
||||
* @param cmdLine
|
||||
*/
|
||||
public void doRun(CommandLine cmdLine) {
|
||||
|
||||
new KernelExcursion() {
|
||||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
final Session session = SessionManager.getSession();
|
||||
final TransactionContext tc = session.getTransactionContext();
|
||||
tc.beginTxn();
|
||||
|
||||
// experimental
|
||||
ApplicationType appType = null;
|
||||
appType = Loader.loadWorkspaceApplicationType();
|
||||
|
||||
// get corresponding package type
|
||||
PackageType packageType = appType.getPackageType();
|
||||
// get all installed instances
|
||||
PackageInstanceCollection allPackages = packageType
|
||||
.getInstances();
|
||||
PackageInstance aPackage = null ;
|
||||
Resource res = null;
|
||||
while ( allPackages.next() ) {
|
||||
aPackage = allPackages.getPackageInstance();
|
||||
res = Resource.createResource((ResourceType)appType,
|
||||
aPackage.getDisplayName(),
|
||||
null);
|
||||
}
|
||||
|
||||
|
||||
appType = null;
|
||||
appType = Loader.loadServiceApplicationType();
|
||||
|
||||
|
||||
tc.commitTxn();
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -181,14 +181,15 @@ public class Application extends Resource {
|
|||
final String title,
|
||||
final Application parent,
|
||||
final boolean createContainerGroup) {
|
||||
final ApplicationType type =
|
||||
ApplicationType.retrieveApplicationTypeForApplication(typeName);
|
||||
final ApplicationType type = ApplicationType
|
||||
.retrieveApplicationTypeForApplication(
|
||||
typeName);
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"No ApplicationType found for type name " + typeName);
|
||||
}
|
||||
return Application.createApplication(type,fragment,
|
||||
title,parent,createContainerGroup);
|
||||
return Application.createApplication(type,fragment,
|
||||
title,parent,createContainerGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -206,10 +207,11 @@ public class Application extends Resource {
|
|||
*/
|
||||
public static Application createApplication(
|
||||
final ApplicationType type,
|
||||
final String fragment,
|
||||
final String title,
|
||||
final Application parent,
|
||||
final boolean createContainerGroup) {
|
||||
final String fragment,
|
||||
final String title,
|
||||
final Application parent,
|
||||
final boolean createContainerGroup) {
|
||||
|
||||
if (Assert.isEnabled()) {
|
||||
Assert.exists(type, ApplicationType.class);
|
||||
Assert.exists(fragment, String.class);
|
||||
|
|
@ -219,10 +221,12 @@ public class Application extends Resource {
|
|||
}
|
||||
s_log.debug("Application type legacy free: " + type.m_legacyFree );
|
||||
if (type.m_legacyFree) {
|
||||
return Application.make(type,fragment,title,parent,createContainerGroup);
|
||||
return Application.make(type,fragment,title,parent,
|
||||
createContainerGroup);
|
||||
} else {
|
||||
s_log.debug("Creating legacy compatible app");
|
||||
return Application.legacyMake(type,fragment,title,parent,createContainerGroup);
|
||||
return Application.legacyMake(type,fragment,title,parent,
|
||||
createContainerGroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -295,6 +299,7 @@ public class Application extends Resource {
|
|||
final String title,
|
||||
final Application parent,
|
||||
final boolean createContainerGroup) {
|
||||
|
||||
final Application application = (Application) Resource.createResource(
|
||||
type, title, parent);
|
||||
if (createContainerGroup) {
|
||||
|
|
@ -636,8 +641,8 @@ public class Application extends Resource {
|
|||
return apps;
|
||||
}
|
||||
|
||||
public static boolean isInstalled
|
||||
(String applicationObjectType, String path) {
|
||||
public static boolean isInstalled (String applicationObjectType,
|
||||
String path) {
|
||||
DataCollection dataCollection =
|
||||
SessionManager.getSession().retrieve(applicationObjectType);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,16 +44,15 @@ import org.apache.log4j.Category;
|
|||
* setup.run();
|
||||
* </blockquote></pre>
|
||||
*
|
||||
* <strong>Important note.</strong> When <code>Application</code>s are
|
||||
* used in the context of old-style apps that use
|
||||
* <code>SiteNode</code>s and <code>PackageType</code>s, it is
|
||||
* important to use the <code>setKey("some-string-key")</code> so that
|
||||
* your new applications can interoperate fluidly with the legacy
|
||||
* applications. Use of the <code>setKey</code> method ensures that
|
||||
* your application will, behind the scenes, use site nodes and
|
||||
* package instances, in addition to the <code>Application</code>
|
||||
* object, to represent each new mountable application. As a result,
|
||||
* legacy code for managing and dispatching applications will work
|
||||
* <strong>Important note.</strong> When <code>Application</code>s are used
|
||||
* in the context of old-style apps that use <code>SiteNode</code>s and
|
||||
* <code>PackageType</code>s, it is important to use the
|
||||
* <code>setKey("some-string-key")</code> so that your new applications can
|
||||
* interoperate fluidly with the legacy applications.
|
||||
* Use of the <code>setKey</code> method ensures that your application will,
|
||||
* behind the scenes, use site nodes and package instances, in addition to the
|
||||
* <code>Application</code> object, to represent each new mountable application.
|
||||
* As a result, legacy code for managing and dispatching applications will work
|
||||
* with both your old and your new applications.
|
||||
*
|
||||
* @see com.arsdigita.web.ApplicationType
|
||||
|
|
@ -62,6 +61,7 @@ import org.apache.log4j.Category;
|
|||
*/
|
||||
public class ApplicationSetup {
|
||||
|
||||
/** Appender to enable writing to the löog file. */
|
||||
protected Category m_category;
|
||||
protected String m_title = null;
|
||||
protected String m_description = null;
|
||||
|
|
@ -76,6 +76,11 @@ public class ApplicationSetup {
|
|||
protected boolean m_isSingleton = false;
|
||||
protected String m_dispatcherClass = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param category as appender to the log file.
|
||||
*/
|
||||
public ApplicationSetup(Category category) {
|
||||
m_category = category;
|
||||
}
|
||||
|
|
@ -143,10 +148,9 @@ public class ApplicationSetup {
|
|||
}
|
||||
|
||||
/**
|
||||
* Marks this applications of this type as ones that do or do not
|
||||
* belong to a "portal", a special application type that collects
|
||||
* child applications together for presentation and navigation
|
||||
* purposes.
|
||||
* Marks this applications of this type as ones that do or do not belong to
|
||||
* a "portal", a special application type that collects child applications
|
||||
* together for presentation and navigation purposes.
|
||||
*
|
||||
* By default, this value is true.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class ApplicationType extends ResourceType {
|
|||
* this case is the same as the Java type (full qualified class name).
|
||||
*/
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.web.ApplicationType";
|
||||
"com.arsdigita.web.ApplicationType";
|
||||
|
||||
private PackageType m_packageType;
|
||||
boolean m_legacyFree = false;
|
||||
|
|
@ -69,12 +69,15 @@ public class ApplicationType extends ResourceType {
|
|||
* Constructor creates a new ApplicationType instance to encapsulate a given
|
||||
* data object (@see com.arsdigita.persistence.Session#retrieve(String) ).
|
||||
* The super implementation uses overwritable methods initialize() and
|
||||
* postInitialization() to further process the dataObject (see below).
|
||||
* postInitialization() to further process the dataObject.
|
||||
*
|
||||
* @param dataObject
|
||||
*/
|
||||
public ApplicationType(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
if (this.getPackageType() == null) { // indicates a legacy free app
|
||||
m_legacyFree = true;
|
||||
} // otherwise leave it on its default value of false
|
||||
}
|
||||
|
||||
protected ApplicationType(String dataObjectType) {
|
||||
|
|
@ -85,6 +88,12 @@ public class ApplicationType extends ResourceType {
|
|||
final String title,
|
||||
final String applicationObjectType) {
|
||||
this(objectType, title, applicationObjectType, false);
|
||||
// under some circumstances m_legacyFree is set correctly to true
|
||||
if (m_legacyFree == false) { //check if default value is correct!
|
||||
if (this.getPackageType() == null) { // indicates a legacy free app
|
||||
m_legacyFree = true;
|
||||
} // otherwise leave it on its default value of false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +237,7 @@ public class ApplicationType extends ResourceType {
|
|||
|
||||
/**
|
||||
* Helper method to create a packageType for a new legacy compatible
|
||||
* application type without a already existing (i.e. installed in db) legacy
|
||||
* application type without an already existing (i.e. installed in db) legacy
|
||||
* application.
|
||||
*
|
||||
* @param key of the package to be created
|
||||
|
|
@ -315,7 +324,8 @@ public class ApplicationType extends ResourceType {
|
|||
|
||||
// Can return null.
|
||||
public static ApplicationType retrieveApplicationTypeForApplication
|
||||
(String applicationObjectType) {
|
||||
(String applicationObjectType) {
|
||||
|
||||
Assert.exists(applicationObjectType, "applicationObjectType");
|
||||
|
||||
DataCollection collection =
|
||||
|
|
@ -609,19 +619,28 @@ public class ApplicationType extends ResourceType {
|
|||
* So wwe have to provide this functionality by ApplicationType as well
|
||||
* which has no kind of "key" by design.
|
||||
*/
|
||||
// XXX we need a better way to determine a name, probably using
|
||||
// the class name without leading package name.
|
||||
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.
|
||||
if (m_legacyFree == true ) {
|
||||
s_log.debug("Expect XSL templates at " + StringUtils.urlize(getTitle()));
|
||||
return StringUtils.urlize(getTitle());
|
||||
} else {
|
||||
return this.getPackageType().getKey();
|
||||
}
|
||||
// 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
|
||||
// time beeing. We check getPackageType to see if m_legacyFree is
|
||||
// really set correctly.
|
||||
if (getPackageType() == null) { // indicates legacy free App
|
||||
s_log.debug("Expect XSL templates at "
|
||||
+ StringUtils.urlize(getTitle()));
|
||||
m_legacyFree = true; // correct m_legacyFree for future use
|
||||
return StringUtils.urlize(getTitle());
|
||||
} else {
|
||||
return this.getPackageType().getKey();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -175,22 +175,12 @@ public class Loader extends PackageLoader {
|
|||
* to lower case.
|
||||
* "Portal Workspace" will become "portal-workspace".
|
||||
*
|
||||
* Creates an entry in table application_types and a corresponding entry in
|
||||
* apm_package_types
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
// legacy package type to back the new application type.
|
||||
// ApplicationType type = ApplicationType.createApplicationType(
|
||||
// "portalworkspace",
|
||||
// "Portal Workspace",
|
||||
// Workspace.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
|
||||
ApplicationType type = new ApplicationType( "Portal Workspace",
|
||||
Workspace.BASE_DATA_OBJECT_TYPE );
|
||||
|
|
|
|||
Loading…
Reference in New Issue