Weiterer Schritte, old initializer auszubauen: Alle einmaligen Initialisierunge jetzt in Loader aktiv. Kein Update erforderlich.
git-svn-id: https://svn.libreccm.org/ccm/trunk@575 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
454f5d12ed
commit
9c5a5c56ac
|
|
@ -142,7 +142,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
// add(new LegacyInitializer("com/arsdigita/cms/contentsection/enterprise.init"));
|
// add(new LegacyInitializer("com/arsdigita/cms/contentsection/enterprise.init"));
|
||||||
|
|
||||||
// Step 4a new
|
// Step 4a new
|
||||||
// Initializer for content section, needed when LegacyInitializer in step 3
|
// Initializer for content section, needed when LegacyInitializer in step 4
|
||||||
// has been moved to c.ad.Loader in order to register the application and
|
// has been moved to c.ad.Loader in order to register the application and
|
||||||
// optionally to install additional content sections.
|
// optionally to install additional content sections.
|
||||||
// add(new com.arsdigita.cms.contentsection.Initializer());
|
// add(new com.arsdigita.cms.contentsection.Initializer());
|
||||||
|
|
@ -256,8 +256,6 @@ public class Initializer extends CompoundInitializer {
|
||||||
FileAsset.BASE_DATA_OBJECT_TYPE,
|
FileAsset.BASE_DATA_OBJECT_TYPE,
|
||||||
new AssetMetadataProvider());
|
new AssetMetadataProvider());
|
||||||
|
|
||||||
// Mount the content-center sidenode
|
|
||||||
|
|
||||||
|
|
||||||
s_log.debug("CMS.Initializer.init(DomainInitEvent) completed");
|
s_log.debug("CMS.Initializer.init(DomainInitEvent) completed");
|
||||||
} // END init(DomainInitEvent e)
|
} // END init(DomainInitEvent e)
|
||||||
|
|
@ -307,8 +305,6 @@ public class Initializer extends CompoundInitializer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
f.registerInstantiator
|
f.registerInstantiator
|
||||||
(Workflow.BASE_DATA_OBJECT_TYPE,
|
(Workflow.BASE_DATA_OBJECT_TYPE,
|
||||||
new ACSObjectInstantiator() {
|
new ACSObjectInstantiator() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
* Copyright (C) 2009 Peter Boy <pb@zes.uni-bremen.de> 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
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
package com.arsdigita.cms;
|
package com.arsdigita.cms;
|
||||||
|
|
||||||
import com.arsdigita.cms.installer.ContentSectionSetup;
|
import com.arsdigita.cms.installer.ContentSectionSetup;
|
||||||
import com.arsdigita.cms.installer.PageClassConfigHandler;
|
// import com.arsdigita.cms.installer.PageClassConfigHandler;
|
||||||
import com.arsdigita.cms.installer.Util;
|
import com.arsdigita.cms.installer.Util;
|
||||||
import com.arsdigita.cms.installer.xml.XMLContentTypeHandler;
|
import com.arsdigita.cms.installer.xml.XMLContentTypeHandler;
|
||||||
import com.arsdigita.cms.installer.WorkspaceInstaller;
|
import com.arsdigita.cms.installer.WorkspaceInstaller;
|
||||||
|
|
@ -28,40 +28,45 @@ import com.arsdigita.cms.portlet.ContentItemPortlet;
|
||||||
//import com.arsdigita.cms.portlet.ContentSectionsPortlet;
|
//import com.arsdigita.cms.portlet.ContentSectionsPortlet;
|
||||||
import com.arsdigita.cms.portlet.TaskPortlet;
|
import com.arsdigita.cms.portlet.TaskPortlet;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
// import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
// import com.arsdigita.domain.DomainObjectInstantiator;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
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.PackageInstance;
|
import com.arsdigita.kernel.PackageInstance;
|
||||||
import com.arsdigita.kernel.PackageType;
|
import com.arsdigita.kernel.PackageType;
|
||||||
import com.arsdigita.kernel.SiteNode;
|
import com.arsdigita.kernel.SiteNode;
|
||||||
import com.arsdigita.kernel.Stylesheet;
|
// import com.arsdigita.kernel.Stylesheet;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
import com.arsdigita.loader.PackageLoader;
|
import com.arsdigita.loader.PackageLoader;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.runtime.ConfigError;
|
import com.arsdigita.runtime.ConfigError;
|
||||||
import com.arsdigita.runtime.ScriptContext;
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
// import com.arsdigita.util.UncheckedWrapperException;
|
||||||
//import com.arsdigita.util.parameter.Parameter;
|
//import com.arsdigita.util.parameter.Parameter;
|
||||||
// import com.arsdigita.util.parameter.BooleanParameter;
|
// import com.arsdigita.util.parameter.BooleanParameter;
|
||||||
//import com.arsdigita.util.parameter.StringParameter;
|
//import com.arsdigita.util.parameter.StringParameter;
|
||||||
//import com.arsdigita.util.parameter.URLParameter;
|
//import com.arsdigita.util.parameter.URLParameter;
|
||||||
// import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
// import com.arsdigita.web.ApplicationType;
|
import com.arsdigita.web.ApplicationSetup;
|
||||||
|
import com.arsdigita.web.ApplicationType;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
import java.io.IOException;
|
// import java.io.IOException;
|
||||||
import java.io.InputStream;
|
// import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
// import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
// import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.parsers.SAXParser;
|
// import javax.xml.parsers.SAXParser;
|
||||||
import javax.xml.parsers.SAXParserFactory;
|
// import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
import org.xml.sax.InputSource;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
|
|
||||||
|
// import org.xml.sax.InputSource;
|
||||||
|
// import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -72,6 +77,10 @@ import org.apache.log4j.Logger;
|
||||||
// method commented IN(!) does load all packages into database and
|
// method commented IN(!) does load all packages into database and
|
||||||
// ccm/admin/sitemap lists them appropriately.
|
// ccm/admin/sitemap lists them appropriately.
|
||||||
// Not yet found a way to mount them in the URL tree while initializing.
|
// Not yet found a way to mount them in the URL tree while initializing.
|
||||||
|
// This is true using the old style application using package / sitenode
|
||||||
|
//
|
||||||
|
// Next Try
|
||||||
|
// Refactor using legacy compatible web/Application and ApplicationSetup
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -102,7 +111,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class Loader extends PackageLoader {
|
public class Loader extends PackageLoader {
|
||||||
|
|
||||||
/** Private logger instance */
|
/** Creates a s_logging category with name = full name of class */
|
||||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
private static final Logger s_log = Logger.getLogger(Loader.class);
|
||||||
|
|
||||||
// Load main CMS configuration file
|
// Load main CMS configuration file
|
||||||
|
|
@ -161,8 +170,6 @@ public class Loader extends PackageLoader {
|
||||||
public final static String SERVICE_PACKAGE_KEY = "cms-service";
|
public final static String SERVICE_PACKAGE_KEY = "cms-service";
|
||||||
|
|
||||||
|
|
||||||
private static HashMap s_pageClasses = new HashMap();
|
|
||||||
private static HashMap s_pageURLs = new HashMap();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -176,60 +183,47 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
|
|
||||||
public void run(final ScriptContext ctx) {
|
public void run(final ScriptContext ctx) {
|
||||||
// XXX: Should move on demand initialization stuff here.
|
|
||||||
s_log.debug("CMS.loader.run() invoked");
|
s_log.debug("CMS.loader.run() invoked");
|
||||||
|
|
||||||
new KernelExcursion() {
|
new KernelExcursion() {
|
||||||
public void excurse() {
|
public void excurse() {
|
||||||
setEffectiveParty(Kernel.getSystemParty());
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
|
// 1 - step 1a) Setup the CMS (content section) package type.
|
||||||
// ////////////////////////
|
// Uses old style application setup kernel.Package and Sitenode.
|
||||||
// Loading CMS package (esp. content center, cms service
|
// It is not needed, this step is included in new style setup
|
||||||
// Used to be step 1 in former enterprise.init file
|
// of content section (see below). It is here for reference
|
||||||
// Implemented by
|
// purpose during migration of the whole CMS to new style.
|
||||||
// com.arsdigita.cms.installer.xml.ContentTypeInitializer
|
|
||||||
// ////////////////////////////////
|
|
||||||
// 1 - step 1a) Setup the CMS package.
|
|
||||||
// loadCMSPackageType();
|
// loadCMSPackageType();
|
||||||
// loadContentSectionPackageType using (new) c.ad.web package.
|
|
||||||
// ContentSectionSetup.setupContentSectionAppType();
|
|
||||||
|
|
||||||
// createPrivileges();
|
|
||||||
|
|
||||||
// 2 - step 1b) Setup the Workspace package.
|
// 2 - step 1b) Setup the Workspace package.
|
||||||
// loadWorkspacePackage();
|
loadWorkspacePackage(); // using old stype
|
||||||
|
// loadWorkspacePackageNewStyle();
|
||||||
|
|
||||||
// 3 - step 1c) Setup the CMS global services package.
|
// 3 - step 1c) Setup the CMS global services package.
|
||||||
// loadServicePackage();
|
loadServicePackage(); // using olde style
|
||||||
|
// loadServicePackageNewStyle();
|
||||||
|
|
||||||
// 4 - stgep 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
|
||||||
|
// any way not a Loader task. It is here for reference
|
||||||
|
// purpose during migration of the whole CMS to new style.
|
||||||
// loadContentCenterMapping(s_conf.getContentCenterMap() );
|
// loadContentCenterMapping(s_conf.getContentCenterMap() );
|
||||||
|
|
||||||
// ////////////////////////
|
|
||||||
// 5) load content type definition(s)
|
// 5) load content type definition(s)
|
||||||
// Loading content type definitions
|
|
||||||
// Used to be step 2 in former enterprise.init file
|
// Used to be step 2 in former enterprise.init file
|
||||||
// Implemented by
|
|
||||||
// com.arsdigita.cms.installer.xml.ContentTypeInitializer
|
|
||||||
// ////////////////////////////////
|
|
||||||
loadContentTypeDefinitions(s_conf.getCTDefFiles() );
|
loadContentTypeDefinitions(s_conf.getCTDefFiles() );
|
||||||
|
|
||||||
// ////////////////////////
|
|
||||||
// 6) Load CMS (content section) package application instance
|
// 6) Load CMS (content section) package application instance
|
||||||
// Loading content section application type and instance
|
|
||||||
// Used to be step 4 in former enterprise.init file
|
// Used to be step 4 in former enterprise.init file
|
||||||
// (step 3 being initialize publishToFile, not to handle in Loader)
|
// (step 3 being initialize publishToFile, not to handle in Loader)
|
||||||
// Implemented by
|
// Implemented by
|
||||||
// com.arsdigita.cms.installer.SectionInitializer
|
// com.arsdigita.cms.installer.SectionInitializer
|
||||||
// ////////////////////////////////
|
// Loads content section application type and instance in one step
|
||||||
loadContentSection(s_conf.getContentSectionName());
|
loadContentSection(s_conf.getContentSectionName());
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////////////////
|
|
||||||
// Loading CMS portlets
|
// Loading CMS portlets
|
||||||
// Used to be step 7 (last step) in former enterprise.init
|
// Used to be step 7 (last step) in former enterprise.init
|
||||||
// ///////////////////////////////////////////////////////
|
|
||||||
s_log.debug("CMS.loader going to load portlets");
|
s_log.debug("CMS.loader going to load portlets");
|
||||||
//ContentDirectoryPortlet.loadPortletType();
|
//ContentDirectoryPortlet.loadPortletType();
|
||||||
ContentItemPortlet.loadPortletType();
|
ContentItemPortlet.loadPortletType();
|
||||||
|
|
@ -248,8 +242,10 @@ public class Loader extends PackageLoader {
|
||||||
*
|
*
|
||||||
* (pb) WRONG:
|
* (pb) WRONG:
|
||||||
* Creates content-section PackageType. Is replaced by newer ApplicationType
|
* Creates content-section PackageType. Is replaced by newer ApplicationType
|
||||||
* mechanisam (see loadContentSection). Must nolonger be used except of
|
* mechanisam (see loadContentSection). Must nolonger be used.
|
||||||
* createPrivileges!
|
* createPrivileges might be included in load, but has te be executed at
|
||||||
|
* each startup to take modifications into accout. So it has to be an
|
||||||
|
* initializer task anyway.
|
||||||
*/
|
*/
|
||||||
private void loadCMSPackageType() {
|
private void loadCMSPackageType() {
|
||||||
s_log.debug("Loading the CMS package type...");
|
s_log.debug("Loading the CMS package type...");
|
||||||
|
|
@ -294,7 +290,8 @@ 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 using old style application.
|
||||||
|
* 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...");
|
||||||
|
|
@ -328,23 +325,51 @@ public class Loader extends PackageLoader {
|
||||||
"Failed to initialize the Workspace package: ");
|
"Failed to initialize the Workspace package: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creating of Workspace package using new style c.ad.web.Application could
|
/**
|
||||||
// be done like the following (legacy compatible style!).
|
* Loads and instantiates the Workspace package (content-center) in the
|
||||||
// Needs refactoring of the Workspace package.
|
* database.
|
||||||
// // Step 1: Create application type
|
*/
|
||||||
// ApplicationType type = ApplicationType
|
private void loadWorkspacePackageNewStyle() {
|
||||||
// .createApplicationType("content-center",
|
s_log.debug("Creating CMS Workspace...");
|
||||||
// "The Content Center Workspace",
|
|
||||||
// ContentCenter.BASE_DATA_OBJECT_TYPE); NEEDED!
|
// Creating of Workspace package using new style c.ad.web.Application
|
||||||
// type.setDescription("The content center workspace for content creators.");
|
// in legacy compatible mode. Needs refactoring of the Workspace package.
|
||||||
//
|
// In a first step these instructions replace c.ad.installer.WorkspaceInstaller
|
||||||
// // Step 2: Create application
|
|
||||||
// Application app = Application.createRootApplication(
|
// create application type
|
||||||
// type,
|
ApplicationSetup appsetup = new ApplicationSetup(s_log);
|
||||||
// "Content Center Workspace");
|
// new style properties
|
||||||
// app.setPath((String) get(m_workspaceURL));
|
appsetup.setApplicationObjectType( Workspace.BASE_DATA_OBJECT_TYPE );
|
||||||
|
appsetup.setTitle( Workspace.INSTANCE_NAME ); // same as for instance
|
||||||
|
// there is only one
|
||||||
|
appsetup.setDescription("The content center workspace for content creators.");
|
||||||
|
// old style / legacy compatible properties
|
||||||
|
appsetup.setKey( Workspace.PACKAGE_KEY );
|
||||||
|
appsetup.setDispatcherClass( Workspace.DISPATCHER_CLASS );
|
||||||
|
// should not be needed anymore, stypesheets handled by StylesheetResolver
|
||||||
|
appsetup.setStylesheet( Workspace.STYLESHEET );
|
||||||
|
appsetup.setSingleton(true);
|
||||||
|
appsetup.setPortalApplication(false);
|
||||||
|
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||||
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
|
return new Workspace(dataObject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ApplicationType workspaceType = appsetup.run();
|
||||||
|
workspaceType.save();
|
||||||
|
|
||||||
|
// create legacy compatible application instance,
|
||||||
|
// old-style package key used as url fragment where to install the instance
|
||||||
|
Workspace app = (Workspace) Application.createApplication(
|
||||||
|
workspaceType, // type
|
||||||
|
Workspace.PACKAGE_KEY, // url fragment
|
||||||
|
Workspace.INSTANCE_NAME,// title
|
||||||
|
null); // parent
|
||||||
|
app.save();
|
||||||
|
|
||||||
s_log.debug("Done loading CMS Workspace.");
|
s_log.debug("Done loading CMS Workspace.");
|
||||||
}
|
}
|
||||||
|
|
@ -353,13 +378,14 @@ public class Loader extends PackageLoader {
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
* migration process.
|
||||||
*/
|
*/
|
||||||
private void loadServicePackage() {
|
private void loadServicePackage() {
|
||||||
s_log.debug("Loading CMS Servce Package...");
|
s_log.debug("Loading CMS Servce Package...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// ServiceInstaller.createPackageType();
|
// from ServiceInstaller.createPackageType();
|
||||||
PackageType type = PackageType.create
|
PackageType type = PackageType.create
|
||||||
(SERVICE_PACKAGE_KEY,
|
(SERVICE_PACKAGE_KEY,
|
||||||
"Content Management System Services",
|
"Content Management System Services",
|
||||||
|
|
@ -369,12 +395,12 @@ public class Loader extends PackageLoader {
|
||||||
"com.arsdigita.cms.dispatcher.ServiceDispatcher");
|
"com.arsdigita.cms.dispatcher.ServiceDispatcher");
|
||||||
type.save();
|
type.save();
|
||||||
|
|
||||||
// PackageInstance instance = ServiceInstaller.createPackageInstance();
|
// from PackageInstance instance = ServiceInstaller.createPackageInstance();
|
||||||
type = PackageType.findByKey(SERVICE_PACKAGE_KEY);
|
type = PackageType.findByKey(SERVICE_PACKAGE_KEY);
|
||||||
PackageInstance instance = type.createInstance(SERVICE_PACKAGE_KEY);
|
PackageInstance instance = type.createInstance(SERVICE_PACKAGE_KEY);
|
||||||
instance.save();
|
instance.save();
|
||||||
|
|
||||||
// ServiceInstaller.mountPackageInstance(instance, url);
|
// from ServiceInstaller.mountPackageInstance(instance, url);
|
||||||
SiteNode node = SiteNode.createSiteNode(SERVICE_URL,
|
SiteNode node = SiteNode.createSiteNode(SERVICE_URL,
|
||||||
SiteNode.getRootSiteNode());
|
SiteNode.getRootSiteNode());
|
||||||
node.mountPackage(instance);
|
node.mountPackage(instance);
|
||||||
|
|
@ -384,137 +410,62 @@ public class Loader extends PackageLoader {
|
||||||
throw new ConfigError
|
throw new ConfigError
|
||||||
("Failed to initialize CMS global services package.");
|
("Failed to initialize CMS global services package.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Creating of Service package using new style c.ad.web.Application could
|
|
||||||
// be done like the following (legacy compatible style!).
|
|
||||||
// Needs refactoring of the Servcie package.
|
|
||||||
// // Step 1: Create application type
|
|
||||||
// ApplicationType type = ApplicationType
|
|
||||||
// .createApplicationType("cms-service", // Type = PACKAGE_KEY,
|
|
||||||
// "Content Management System Services",
|
|
||||||
// SERVICE_BASE_DATA_OBJECT_TYPE);
|
|
||||||
// // Step 2: Create application
|
|
||||||
// Application workspace = Application.createRootApplication(
|
|
||||||
// type,
|
|
||||||
// "Content Center Workspace");
|
|
||||||
// app.setPath((String) get(m_workspaceURL));
|
|
||||||
|
|
||||||
s_log.debug("Done creating CMS Servce Package.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void loadContentCenterMapping(String mapFileName) throws ConfigError {
|
|
||||||
|
|
||||||
final PageClassConfigHandler handler
|
|
||||||
= new PageClassConfigHandler(s_pageClasses, s_pageURLs);
|
|
||||||
|
|
||||||
final ClassLoader loader = Thread.currentThread
|
|
||||||
().getContextClassLoader();
|
|
||||||
final InputStream input = loader.getResourceAsStream
|
|
||||||
(mapFileName.substring(1));
|
|
||||||
|
|
||||||
if (input == null) {
|
|
||||||
throw new IllegalStateException(mapFileName + " not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
final InputSource source = new InputSource
|
|
||||||
(input);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final SAXParserFactory spf = SAXParserFactory.newInstance();
|
|
||||||
final SAXParser parser = spf.newSAXParser();
|
|
||||||
parser.parse(source, handler);
|
|
||||||
} catch (ParserConfigurationException e) {
|
|
||||||
throw new UncheckedWrapperException("error parsing dispatcher config", e);
|
|
||||||
} catch (SAXException e) {
|
|
||||||
throw new UncheckedWrapperException("error parsing dispatcher config", e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new UncheckedWrapperException("error parsing dispatcher config", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses XML file definition of content types and loads them to the
|
* CMS Service application is used by the Content Management System as a
|
||||||
* database. The XML config looks like the example below, the
|
* store for global resources and assets.
|
||||||
* "parentType" and "name" attributes are optional, and only required
|
|
||||||
* for creating User Defined ContentTypes. Label corresponds to
|
|
||||||
* ContentType's label and can be multiple words, and "name" to
|
|
||||||
* DynamicObject's name property, and must be a single word. The
|
|
||||||
* objectType attribute is ignored for UDCTs, as it gets dynamically
|
|
||||||
* generated.
|
|
||||||
*
|
*
|
||||||
* <b>UDCT Copyright</b>
|
|
||||||
* <pre>
|
|
||||||
* <ccm:content-types>
|
|
||||||
* <ccm:content-type
|
|
||||||
* name="Copyright"
|
|
||||||
* label="UDCT Copyright"
|
|
||||||
* parentType="com.arsdigita.cms.contenttypes.Address"
|
|
||||||
* classname="com.arsdigita.cms.contenttypes.Address"
|
|
||||||
* description="Copyright for storing copyright information"
|
|
||||||
* objectType="com.arsdigita.cms.contentTypes.Address" >
|
|
||||||
*
|
|
||||||
* <ccm:authoring-kit>
|
|
||||||
* </ccm:authoring-kit>
|
|
||||||
* </ccm:content-type>
|
|
||||||
* </ccm:content-types>
|
|
||||||
*</pre>
|
|
||||||
*
|
|
||||||
* @see XMLContentTypeHandler
|
|
||||||
*/
|
*/
|
||||||
private void loadContentTypeDefinitions(List ctDefFiles) {
|
private void loadServicePackageNewStyle() {
|
||||||
s_log.debug("Loading content type definitions ...");
|
s_log.debug("Loading CMS Servce Package...");
|
||||||
|
|
||||||
if ( ctDefFiles != null) {
|
|
||||||
Iterator i = ctDefFiles.iterator();
|
|
||||||
while (i.hasNext()) {
|
|
||||||
// TransactionContext txn = SessionManager.getSession()
|
|
||||||
// .getTransactionContext();
|
|
||||||
// txn.beginTxn();
|
|
||||||
|
|
||||||
String xmlFile = (String)i.next();
|
// Creating Service package using new style c.ad.web.Application
|
||||||
s_log.debug("Processing contentTypes in: " + xmlFile);
|
// in legacy compatible mode. Needs refactoring of the Service package.
|
||||||
XML.parseResource(xmlFile, new XMLContentTypeHandler());
|
// In a first step these instructions replace c.ad.installer.ServiceInstaller
|
||||||
|
|
||||||
// txn.commitTxn();
|
// create application type
|
||||||
}
|
ApplicationSetup appsetup = new ApplicationSetup(s_log);
|
||||||
|
// new style properties
|
||||||
|
appsetup.setApplicationObjectType( Service.BASE_DATA_OBJECT_TYPE );
|
||||||
|
appsetup.setTitle( Service.INSTANCE_NAME ); // same as for instance
|
||||||
|
// there is only one
|
||||||
|
appsetup.setDescription("Services to store global resources and assets.");
|
||||||
|
// 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() {
|
||||||
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
|
return new Service(dataObject);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
s_log.debug("Done loading content type definitions.");
|
ApplicationType serviceType = appsetup.run();
|
||||||
|
serviceType.save();
|
||||||
|
|
||||||
|
// create legacy compatible application instance,
|
||||||
|
// old-style package key used as url fragment where to install the instance
|
||||||
|
Service app = (Service) Application.createApplication(
|
||||||
|
serviceType, // type
|
||||||
|
Service.PACKAGE_KEY, // url fragment
|
||||||
|
Service.INSTANCE_NAME,// title
|
||||||
|
null); // parent
|
||||||
|
app.save();
|
||||||
|
|
||||||
|
s_log.debug("Done creating CMS Service Package.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the CMS privileges.
|
* Load an content section application type and an initial default
|
||||||
*/
|
* content-section instance as specified in LoaderConfig.
|
||||||
private static void createPrivileges() {
|
* Uses new style application in legacy compatible mode.
|
||||||
s_log.debug("Creating Privileges...");
|
|
||||||
|
|
||||||
final String CMS_PRIVILEGES = "com.arsdigita.cms.getPrivileges";
|
|
||||||
final String PRIVILEGE = "privilege";
|
|
||||||
|
|
||||||
DataQuery dq = SessionManager.getSession().retrieveQuery(CMS_PRIVILEGES);
|
|
||||||
try {
|
|
||||||
while ( dq.next() ) {
|
|
||||||
String privilege = (String) dq.get(PRIVILEGE);
|
|
||||||
if ( PrivilegeDescriptor.get(privilege) == null ) {
|
|
||||||
PrivilegeDescriptor.createPrivilege(privilege);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
dq.close();
|
|
||||||
}
|
|
||||||
s_log.debug("Done creating Privileges.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load an initial default content-section, specified in LoaderConfig.
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void loadContentSection(String name) {
|
private void loadContentSection(String name) {
|
||||||
|
|
@ -525,11 +476,11 @@ public class Loader extends PackageLoader {
|
||||||
// concrete content-section instance can be created.
|
// concrete content-section instance can be created.
|
||||||
ContentSectionSetup.setupContentSectionAppType();
|
ContentSectionSetup.setupContentSectionAppType();
|
||||||
|
|
||||||
|
createPrivileges();
|
||||||
|
|
||||||
// Step 2: Validatge name for section
|
// Step 2: Validatge name for section
|
||||||
Util.validateURLParameter("name", name);
|
Util.validateURLParameter("name", name);
|
||||||
|
|
||||||
|
|
||||||
// Step 3: Create the installation default content section "name"
|
// Step 3: Create the installation default content section "name"
|
||||||
ContentSection section = ContentSection.create(name);
|
ContentSection section = ContentSection.create(name);
|
||||||
|
|
||||||
|
|
@ -577,6 +528,79 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses XML file definition of content types and loads them to the
|
||||||
|
* database. The XML config looks like the example below, the
|
||||||
|
* "parentType" and "name" attributes are optional, and only required
|
||||||
|
* for creating User Defined ContentTypes. Label corresponds to
|
||||||
|
* ContentType's label and can be multiple words, and "name" to
|
||||||
|
* DynamicObject's name property, and must be a single word. The
|
||||||
|
* objectType attribute is ignored for UDCTs, as it gets dynamically
|
||||||
|
* generated.
|
||||||
|
*
|
||||||
|
* <b>UDCT Copyright</b>
|
||||||
|
* <pre>
|
||||||
|
* <ccm:content-types>
|
||||||
|
* <ccm:content-type
|
||||||
|
* name="Copyright"
|
||||||
|
* label="UDCT Copyright"
|
||||||
|
* parentType="com.arsdigita.cms.contenttypes.Address"
|
||||||
|
* classname="com.arsdigita.cms.contenttypes.Address"
|
||||||
|
* description="Copyright for storing copyright information"
|
||||||
|
* objectType="com.arsdigita.cms.contentTypes.Address" >
|
||||||
|
*
|
||||||
|
* <ccm:authoring-kit>
|
||||||
|
* </ccm:authoring-kit>
|
||||||
|
* </ccm:content-type>
|
||||||
|
* </ccm:content-types>
|
||||||
|
*</pre>
|
||||||
|
*
|
||||||
|
* @see XMLContentTypeHandler
|
||||||
|
*/
|
||||||
|
private void loadContentTypeDefinitions(List ctDefFiles) {
|
||||||
|
s_log.debug("Loading content type definitions ...");
|
||||||
|
|
||||||
|
if ( ctDefFiles != null) {
|
||||||
|
Iterator i = ctDefFiles.iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
String xmlFile = (String)i.next();
|
||||||
|
s_log.debug("Processing contentTypes in: " + xmlFile);
|
||||||
|
XML.parseResource(xmlFile, new XMLContentTypeHandler());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s_log.debug("Done loading content type definitions.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Integrates the CMS privileges into the Core permision system.
|
||||||
|
*
|
||||||
|
* Skips through the CMS specific privileges and integrates those which are
|
||||||
|
* missing in core's acs_privileges into it, so the systems security system
|
||||||
|
* is aware of it.
|
||||||
|
*/
|
||||||
|
private static void createPrivileges() {
|
||||||
|
s_log.debug("Creating Privileges...");
|
||||||
|
|
||||||
|
final String CMS_PRIVILEGES = "com.arsdigita.cms.getPrivileges";
|
||||||
|
final String PRIVILEGE = "privilege";
|
||||||
|
|
||||||
|
DataQuery dq = SessionManager.getSession().retrieveQuery(CMS_PRIVILEGES);
|
||||||
|
try {
|
||||||
|
while ( dq.next() ) {
|
||||||
|
String privilege = (String) dq.get(PRIVILEGE);
|
||||||
|
s_log.debug(String.format("privilege = %s", privilege));
|
||||||
|
if ( PrivilegeDescriptor.get(privilege) == null ) {
|
||||||
|
PrivilegeDescriptor.createPrivilege(privilege);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
dq.close();
|
||||||
|
}
|
||||||
|
s_log.debug("Done creating Privileges.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ public class ContentCenterDispatcher extends LockableImpl
|
||||||
/**
|
/**
|
||||||
* The path of the file that maps resources.
|
* The path of the file that maps resources.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final static String DEFAULT_MAP_FILE = "/WEB-INF/resources/content-center-map.xml";
|
public final static String DEFAULT_MAP_FILE = "/WEB-INF/resources/content-center-map.xml";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.initializer.InitializationException;
|
import com.arsdigita.initializer.InitializationException;
|
||||||
import com.arsdigita.kernel.PackageInstance;
|
import com.arsdigita.kernel.PackageInstance;
|
||||||
import com.arsdigita.kernel.PackageType;
|
import com.arsdigita.kernel.PackageType;
|
||||||
import com.arsdigita.kernel.Stylesheet;
|
// import com.arsdigita.kernel.Stylesheet;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
|
@ -39,7 +39,7 @@ import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the content section.
|
* Sets up the CMS package.
|
||||||
*
|
*
|
||||||
* @author Jon Orris (jorris@redhat.com)
|
* @author Jon Orris (jorris@redhat.com)
|
||||||
* @version $Revision: #10 $ $DateTime: 2004/08/17 23:15:09 $
|
* @version $Revision: #10 $ $DateTime: 2004/08/17 23:15:09 $
|
||||||
|
|
@ -101,26 +101,34 @@ public final class ContentCenterSetup {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// 1) Setup the CMS package.
|
// 1) Setup the content section package.
|
||||||
setupCMSPackage();
|
// Currently just invokes createPrivileges, which should be executed
|
||||||
|
// at each system startup to check for modifications. So it is an
|
||||||
|
// Initializer task and will be moved to an Initializer.
|
||||||
|
// setupCMSPackage();
|
||||||
|
// createPrivileges();
|
||||||
|
|
||||||
// 2) Setup the Workspace package.
|
// 2) Setup the Workspace package.
|
||||||
|
// Moved to Loader
|
||||||
setupWorkspacePackage();
|
// setupWorkspacePackage();
|
||||||
|
|
||||||
// 3) Setup the CMS global services package.
|
// 3) Setup the CMS global services package.
|
||||||
setupServicePackage();
|
// Moved to Loader
|
||||||
|
// setupServicePackage();
|
||||||
|
|
||||||
// 8) Load the content-center page mappings
|
// 8) Load the content-center page mappings
|
||||||
|
// Has to be executed an each system startup and is an
|
||||||
|
// Initializer task.
|
||||||
setupContentCenter();
|
setupContentCenter();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the CMS package type if it does not already exist.
|
* Creates the CMS (i.e. content section) package type if it does not already exist.
|
||||||
*
|
*
|
||||||
* Actually: Creates the PackageType contentsection!
|
* Actually: Creation ot content section is migrated to loader. Just used to
|
||||||
|
* create privileges.
|
||||||
*/
|
*/
|
||||||
private static void setupCMSPackage() {
|
private static void setupCMSPackage() {
|
||||||
if ( !PackageType.typeExists(Installer.PACKAGE_KEY) ) { //key = content-section
|
if ( !PackageType.typeExists(Installer.PACKAGE_KEY) ) { //key = content-section
|
||||||
|
|
@ -217,6 +225,12 @@ public final class ContentCenterSetup {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the content center page mappings.
|
||||||
|
* Mapping stored in hashMaps, must be run during each system startup, so
|
||||||
|
* it is an initializer task.
|
||||||
|
* @throws InitializationException
|
||||||
|
*/
|
||||||
private void setupContentCenter() throws InitializationException {
|
private void setupContentCenter() throws InitializationException {
|
||||||
final PageClassConfigHandler handler
|
final PageClassConfigHandler handler
|
||||||
= new PageClassConfigHandler(s_pageClasses, s_pageURLs);
|
= new PageClassConfigHandler(s_pageClasses, s_pageURLs);
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,18 @@ import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
// CURRENT STATUS:
|
// WORK IN PROGRESS
|
||||||
|
// Migrating the CMS Code from old style initializer and old style application
|
||||||
|
// to new style initializer and new style application.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Plannings
|
||||||
|
// 1. Step
|
||||||
// (Simple) Migration of the Old Initializer code of this package to the new
|
// (Simple) Migration of the Old Initializer code of this package to the new
|
||||||
// initializer system. Current goal is a pure replacement with as less code
|
// initializer system. Current goal is a pure replacement with as less code
|
||||||
// changes as possible.
|
// changes as possible.
|
||||||
// In a second step a restructure of the code will be done.
|
// 2. Step
|
||||||
|
// Restructuring codel eventually remove this Initializer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XXX Reformulate according to the code development!
|
* XXX Reformulate according to the code development!
|
||||||
|
|
@ -51,12 +58,12 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class Initializer extends CompoundInitializer {
|
public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
|
|
||||||
/** Creates a s_logging category with name = to the full name of class */
|
/** Creates a s_logging category with name = to the full name of class */
|
||||||
private static Logger s_log = Logger.getLogger(Initializer.class);
|
private static Logger s_log = Logger.getLogger(Initializer.class);
|
||||||
|
|
||||||
private static final LoaderConfig s_conf = new LoaderConfig();
|
private static final LoaderConfig s_conf = new LoaderConfig();
|
||||||
// Verursacht aktuell eine Exception "no such contgext"
|
// Verursacht aktuell eine Exception "no such context"
|
||||||
|
// Vermutliche Lösung: in config.xml eintragen.
|
||||||
// static { // requirred to actually read the config file!
|
// static { // requirred to actually read the config file!
|
||||||
// s_conf.load();
|
// s_conf.load();
|
||||||
// }
|
// }
|
||||||
|
|
@ -87,13 +94,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
public void init(DomainInitEvent evt) {
|
public void init(DomainInitEvent evt) {
|
||||||
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked");
|
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked");
|
||||||
|
|
||||||
// Recursive invokation of init, is it really necessary??
|
super.init(evt); // !
|
||||||
// On the other hand:
|
|
||||||
// An empty implementations prevents this initializer from being executed.
|
|
||||||
// A missing implementations causes the super class method to be executed,
|
|
||||||
// which invokes the above added LegacyInitializer.
|
|
||||||
// If super is not invoked, various other cms sub-initializer may not run.
|
|
||||||
super.init(evt);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Imported from LegacyInitializer:
|
* Imported from LegacyInitializer:
|
||||||
|
|
@ -138,13 +139,10 @@ public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
final String workspaceURL = s_conf.getWorkspaceURL();
|
final String workspaceURL = s_conf.getWorkspaceURL();
|
||||||
final String contentCenterMap = s_conf.getContentCenterMap();
|
final String contentCenterMap = s_conf.getContentCenterMap();
|
||||||
ContentCenterSetup centerSetup = new ContentCenterSetup(
|
ContentCenterSetup centerSetup = new ContentCenterSetup( workspaceURL,
|
||||||
workspaceURL,
|
|
||||||
contentCenterMap);
|
contentCenterMap);
|
||||||
|
|
||||||
centerSetup.run();
|
centerSetup.run();
|
||||||
|
|
||||||
|
|
||||||
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) completed");
|
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import com.arsdigita.kernel.SiteNode;
|
||||||
import com.arsdigita.kernel.Stylesheet;
|
import com.arsdigita.kernel.Stylesheet;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Provides methods to install the Content Center application, which
|
* <p>Provides methods to install the Content Center application, which
|
||||||
* is used by the Content Management System.</p>
|
* is used by the Content Management System.</p>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue