Modul ccm-cms wird jetzt als new style legacy compatible application initialisiert. Update 6.6.1-6.6.2 erforderlich.

git-svn-id: https://svn.libreccm.org/ccm/trunk@908 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-05-14 10:40:58 +00:00
parent c286cc5fdb
commit f45285e98d
6 changed files with 151 additions and 29 deletions

View File

@ -0,0 +1,37 @@
--
-- 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_table_applications.sql pboy $
update applications
set package_id = (select site_nodes.object_id
from site_nodes
where site_nodes.url = applications.primary_url)
where application_type_id = (select application_types.application_type_id
from application_types
where object_type
like 'com.arsdigita.cms.Workspace');
update applications
set package_id = (select site_nodes.object_id
from site_nodes
where site_nodes.url = applications.primary_url)
where application_type_id = (select application_types.application_type_id
from application_types
where object_type
like 'com.arsdigita.cms.Service');

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
--
-- $Id: oracle-se-6.6.1-6.6.2.sql 293 2011-05-13 15:10:39Z pboy $
PROMPT Red Hat Enterprise CMS 6.6.1 -> 6.6.2 Upgrade Script (Oracle)
@@ ../default/upgrade/6.6.1-6.6.2/upd_table_applications.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: 2011/05/13 23:15:09 $
\echo Red Hat Enterprise CMS 6.6.1 -> 6.6.2 Upgrade Script (PostgreSQL)
begin;
\i ../default/upgrade/6.6.1-6.6.2/upd_table_applications.sql
commit;

View File

@ -36,16 +36,12 @@
<version from="6.5.3" to="6.5.4"> <version from="6.5.3" to="6.5.4">
<script sql="ccm-cms/upgrade/::database::-6.5.3-6.5.4.sql"/> <script sql="ccm-cms/upgrade/::database::-6.5.3-6.5.4.sql"/>
</version> </version>
<version from="6.6.0" to="6.6.1"> <version from="6.6.0" to="6.6.1">
<script sql="ccm-cms/upgrade/::database::-6.6.0-6.6.1.sql"/> <script sql="ccm-cms/upgrade/::database::-6.6.0-6.6.1.sql"/>
<script class="com.arsdigita.cms.upgrade.CreateGenericContentTypes"/> <script class="com.arsdigita.cms.upgrade.CreateGenericContentTypes"/>
</version> </version>
<version from="6.6.1" to="6.6.2"> <version from="6.6.1" to="6.6.2">
<script class="com.arsdigita.cms.upgrade.AddNewStyleApplicationEntries"/> <script class="com.arsdigita.cms.upgrade.AddNewStyleApplicationEntries"/>
<!-- <script sql="ccm-cms/upgrade/::database::-6.6.1-6.6.2.sql"/>
<script sql="ccm-cms/upgrade/::database::-6.6.0-6.6.1.sql"/>
-->
</version> </version>
</upgrade> </upgrade>

View File

@ -170,12 +170,16 @@ public class Loader extends PackageLoader {
// loadCMSPackageType(); // loadCMSPackageType();
// 2 - step 1b) Setup the Workspace package. // 2 - step 1b) Setup the Workspace package.
loadWorkspacePackage(); // using old stype // loadWorkspacePackage(); // using old stype
// loadWorkspacePackageNewStyle(); // using new style // new style:
ApplicationType appType = loadWorkspaceApplicationType();
setupDefaultWorkspaceApplicationInstance(appType);
// 3 - step 1c) Setup the CMS global services package. // 3 - step 1c) Setup the CMS global services package.
loadServicePackage(); // using olde style // loadServicePackage(); // using olde style
// loadServicePackageNewStyle(); // using new style // new style:
appType = loadServiceApplicationType();
setupDefaultServiceApplicationInstance(appType);
// 4 - step 1d) Load the content-center page mappings // 4 - step 1d) Load the content-center page mappings
// Wrong! Is Initializer task, must be done each startup, in // Wrong! Is Initializer task, must be done each startup, in
@ -268,11 +272,12 @@ public class Loader extends PackageLoader {
// //
// s_log.debug("Done creating the CMS package type."); // s_log.debug("Done creating the CMS package type.");
// } // }
/** // /**
* Loads and instantiates the Workspace package (content-center) in the // * Loads and instantiates the Workspace package (content-center) in the
* database using old style application. // * database using old style application.
* Will be replaced by new style application in the migration process, // * Will be replaced by new style application in the migration process,
*/ // */
/*
private void loadWorkspacePackage() { private void loadWorkspacePackage() {
s_log.debug("Creating CMS Workspace..."); s_log.debug("Creating CMS Workspace...");
@ -312,10 +317,12 @@ public class Loader extends PackageLoader {
} }
} }
*/
/** /**
* Loads and instantiates the Workspace package (content-center) in the * Loads and instantiates the Workspace package (content-center) in the
* database. * database.
* It is made public to be able to invoke it from the update script
* (e.g. 6.6.1-6.6.2).
*/ */
public static ApplicationType loadWorkspaceApplicationType() { public static ApplicationType loadWorkspaceApplicationType() {
s_log.warn("Creating CMS Workspace..."); s_log.warn("Creating CMS Workspace...");
@ -365,19 +372,20 @@ public class Loader extends PackageLoader {
Workspace.PACKAGE_KEY, // url fragment Workspace.PACKAGE_KEY, // url fragment
Workspace.INSTANCE_NAME,// title Workspace.INSTANCE_NAME,// title
null); // parent null); // parent
app.setDescription("The default CMS workspace instance.");
app.save(); app.save();
s_log.warn("CMS Workspace instance created."); s_log.warn("CMS Workspace instance created.");
s_log.debug("Done loading CMS Workspace."); s_log.debug("Done loading CMS Workspace.");
} }
/** // /**
* CMS Service application is used by the Content Management System as a // * CMS Service application is used by the Content Management System as a
* store for global resources and assets. // * store for global resources and assets.
* Using old style application, will be replaced by new style in the // * Using old style application, will be replaced by new style in the
* migration process. // * migration process.
*/ // */
private void loadServicePackage() { /* private void loadServicePackage() {
s_log.debug("Loading CMS Servce Package..."); s_log.debug("Loading CMS Servce Package...");
try { try {
@ -405,11 +413,12 @@ public class Loader extends PackageLoader {
throw new ConfigError("Failed to initialize CMS global services package."); throw new ConfigError("Failed to initialize CMS global services package.");
} }
} }
*/
/** /**
* CMS Service application is used by the Content Management System as a * CMS Service application is used by the Content Management System as a
* store for global resources and assets. * store for global resources and assets.
* * It is made public to be able to invoke it from the update script
* (e.g. 6.6.1-6.6.2).
*/ */
public static ApplicationType loadServiceApplicationType() { public static ApplicationType loadServiceApplicationType() {
s_log.debug("Loading CMS Servce Package..."); s_log.debug("Loading CMS Servce Package...");
@ -458,6 +467,7 @@ public class Loader extends PackageLoader {
Service.PACKAGE_KEY, // url fragment Service.PACKAGE_KEY, // url fragment
Service.INSTANCE_NAME,// title Service.INSTANCE_NAME,// title
null); // parent null); // parent
app.setDescription("The default CMS service instance.");
app.save(); app.save();
s_log.debug("Done creating CMS Service Package."); s_log.debug("Done creating CMS Service Package.");

View File

@ -19,7 +19,6 @@
package com.arsdigita.cms.upgrade; package com.arsdigita.cms.upgrade;
import com.arsdigita.cms.Loader; import com.arsdigita.cms.Loader;
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;
@ -31,6 +30,8 @@ import com.arsdigita.packaging.Program;
import com.arsdigita.persistence.Session; import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext; import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.util.StringUtils;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationType; import com.arsdigita.web.ApplicationType;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;
@ -56,10 +57,12 @@ public class AddNewStyleApplicationEntries extends Program {
private static Logger s_log = Logger.getLogger(CreateGenericContentTypes.class); private static Logger s_log = Logger.getLogger(CreateGenericContentTypes.class);
/** /**
/* Constructor /* Constructor constructs a program object which initializes the CCM
* runtime system and enables concatenation, so a following SQL script
* may be executed.
*/ */
public AddNewStyleApplicationEntries() { public AddNewStyleApplicationEntries() {
super("AddNewStyleApplicationEntries", "1.0.0", ""); super("AddNewStyleApplicationEntries", "1.0.0", "",true,true);
} }
@ -86,10 +89,9 @@ public class AddNewStyleApplicationEntries extends Program {
final TransactionContext tc = session.getTransactionContext(); final TransactionContext tc = session.getTransactionContext();
tc.beginTxn(); tc.beginTxn();
// experimental // Update CMS Workspace
ApplicationType appType = null; ApplicationType appType = null;
appType = Loader.loadWorkspaceApplicationType(); appType = Loader.loadWorkspaceApplicationType();
// get corresponding package type // get corresponding package type
PackageType packageType = appType.getPackageType(); PackageType packageType = appType.getPackageType();
// get all installed instances // get all installed instances
@ -97,16 +99,45 @@ public class AddNewStyleApplicationEntries extends Program {
.getInstances(); .getInstances();
PackageInstance aPackage = null ; PackageInstance aPackage = null ;
Resource res = null; Resource res = null;
Application app = null;
while ( allPackages.next() ) { while ( allPackages.next() ) {
aPackage = allPackages.getPackageInstance(); aPackage = allPackages.getPackageInstance();
res = Resource.createResource((ResourceType)appType, res = Resource.createResource((ResourceType)appType,
aPackage.getDisplayName(), aPackage.getDisplayName(),
null); null);
res.setDescription("The default CMS workspace instance.");
res.save();
app = Application.retrieveApplication(res.getOID());
app.setPath("/"+StringUtils.urlize(app.getTitle())+"/");
// unfortunately there seems to be no way to set the
// assoziation to PackageInstance. So we must do that by
// SQL magic
} }
// Update CMS Service
appType = null; appType = null;
appType = Loader.loadServiceApplicationType(); appType = Loader.loadServiceApplicationType();
// get corresponding package type
packageType = appType.getPackageType();
// get all installed instances
allPackages = packageType.getInstances();
aPackage = null ;
res = null;
app = null;
while ( allPackages.next() ) {
aPackage = allPackages.getPackageInstance();
res = Resource.createResource((ResourceType)appType,
aPackage.getDisplayName(),
null);
res.setDescription("The default CMS service instance.");
res.save();
app = Application.retrieveApplication(res.getOID());
app.setPath("/"+StringUtils.urlize(app.getTitle())+"/");
// unfortunately there seems to be no way to set the
// assoziation to PackageInstance. So we must do that by
// SQL magic
}
tc.commitTxn(); tc.commitTxn();