diff --git a/ccm-bundle/src/com/arsdigita/bundle/Loader.java b/ccm-bundle/src/com/arsdigita/bundle/Loader.java
index 1a74e9b52..5925e3e05 100644
--- a/ccm-bundle/src/com/arsdigita/bundle/Loader.java
+++ b/ccm-bundle/src/com/arsdigita/bundle/Loader.java
@@ -49,6 +49,10 @@ import java.util.StringTokenizer;
*
* Creates category domains in the terms application according to
* configuration files and adds jsp templates to navigation.
+ *
+ * NOTE: Configuration parameters used at load time MUST be part of Loader
+ * class and can not delegated to a Config object (derived from AbstractConfig).
+ * They will (and can) not be persisted into an registry object (file).
*
* @author Justin Ross <jross@redhat.com>
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
@@ -70,9 +74,11 @@ public class Loader extends PackageLoader {
* FULL_QUALIFIED_CLASS_NAME : URL : TITLE ,
* .... ,
* FULL_QUALIFIED_CLASS_NAME : URL : TITLE "
+ * E.G.
+ * "com.arsdigita.navigation.Navigation:local:Local Navigation"
*/
private Parameter m_customApplicationInstances = new StringArrayParameter(
- "com.arsdigita.bundle.local_app_instances",
+ "com.arsdigita.bundle.loader.custom_app_instances",
Parameter.OPTIONAL, null
);
@@ -84,7 +90,7 @@ public class Loader extends PackageLoader {
* Files are stored as part of the jar, so classloader can find them.
*/
private Parameter m_categoryFiles = new StringArrayParameter(
- "com.arsdigita.bundle.category_files",
+ "com.arsdigita.bundle.loader.category_files",
Parameter.REQUIRED,new String[]{
"bundle/categories/gen-nav-domain-1.00.xml",
"bundle/categories/gen-nav-hierarchy-1.00.xml" }
@@ -107,7 +113,7 @@ public class Loader extends PackageLoader {
*
*/
private Parameter m_domainMappings = new StringArrayParameter(
- "com.arsdigita.bundle.domain_mappings",
+ "com.arsdigita.bundle.loader.domain_mappings",
Parameter.REQUIRED,new String[]{ "STD-NAV:/navigation/",
"STD-NAV:/content/",
"STD-NAV:/portal/" }
diff --git a/ccm-bundle/src/com/arsdigita/bundle/Loader_parameter.properties b/ccm-bundle/src/com/arsdigita/bundle/Loader_parameter.properties
new file mode 100755
index 000000000..b2f53f3ef
--- /dev/null
+++ b/ccm-bundle/src/com/arsdigita/bundle/Loader_parameter.properties
@@ -0,0 +1,14 @@
+com.arsdigita.bundle.loader.custom_app_instances.title= Applications to create
+com.arsdigita.bundle.loader.custom_app_instances.purpose=List of comma separated sets of application instance specifications,optionally used to create arbitrary custom application instances
+com.arsdigita.bundle.loader.custom_app_instances.example=com.arsdigita.navigation.Navigation:scimenu:ScientificCMS Navigation Menu,com.arsdigita.navigation.Navigation:libmenu:LibreCMS Navigation Menu
+com.arsdigita.bundle.loader.custom_app_instances.format=CLASS_NAME:URL:TITLE[,CLASS_NAME:URL:TITLE[,...]]
+
+com.arsdigita.bundle.loader.category_files.title= Domain Categories Definitions Files
+com.arsdigita.bundle.loader.category_files.purpose=Comma separated list of fully qualified filenames.
+com.arsdigita.bundle.loader.category_files.example=bundle/categories/gen-nav-domain-1.00.xml,bundle/categories/gen-nav-hierarchy-1.00.xml
+com.arsdigita.bundle.loader.category_files.format=[StringArray]
+
+com.arsdigita.bundle.loader.domain_mappings.title= Domain Mappings
+com.arsdigita.bundle.loader.domain_mappings.purpose=List of comma separated sets of domain mappings.
+com.arsdigita.bundle.loader.domain_mappings.example=STD-NAV:/navigation/,STD-NAV:/content/,STD-NAV:/portal/
+com.arsdigita.bundle.loader.domain_mappings.format=[StringArray]
diff --git a/ccm-cms-types-job/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Job.xml b/ccm-cms-types-job/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Job.xml
index de9d364a5..23200e130 100755
--- a/ccm-cms-types-job/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Job.xml
+++ b/ccm-cms-types-job/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Job.xml
@@ -1,7 +1,16 @@
- Executes nonrecurring at install time and loads (installs and initializes)
* the Content Management System module,including the Content Center, CMS Service
@@ -92,57 +92,73 @@ public class Loader extends PackageLoader {
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger(Loader.class);
- /** Loader configuration object, singleton design pattern */
+ /** Loader configuration object, singleton design pattern
+ * NOTE: LoaderConfig only supplies unmutable hatrd coded defaults! It is
+ * not possible to alter any to the contained values by specifiying an
+ * configuration parameter during load step. If a configuration value
+ * has to be configurable at load time, the parameter must be relcated
+ * into this Loader class! */
private static final LoaderConfig s_conf = LoaderConfig.getInstance();
+ // ///////////////////////////////////////////////////////////////////
+ // Configurable parameters during load step.
+ // ///////////////////////////////////////////////////////////////////
+
/**
- * Constant string used as key for creating CMS (content-section) as a
- * legacy application.
+ * The name(s) of the content section(s). In case of more than one name the
+ * first is treated as default section. Otherwise the section created is the
+ * default section. More sections can always be created during a subsequent
+ * system startup using initialization parameters.
*/
- private final static String CMS_PACKAGE_KEY = "content-section";
- /**
- * Dispatcher class for CMS (needed to be assigned to a legacy application).
- */
- private final static String CMS_DISPATCHER_CLASS =
- "com.arsdigita.cms.dispatcher.ContentSectionDispatcher";
+ private final Parameter m_contentSectionNames = new StringArrayParameter(
+ "com.arsdigita.cms.loader.section_names",
+ Parameter.REQUIRED,
+ new String[] {"content"}
+ );
+
+
+// Nolonger used
// /**
-// * Stylesheet which has to be assigned as part of a legacy application
-// * creation.
+// * Constant string used as key for creating CMS (content-section) as a
+// * legacy application.
// */
-// Assigned stylesheets no longer used and base class removed.
-// private final static String CMS_STYLESHEET =
-// "/packages/content-section/xsl/cms.xsl";
+// private final static String CMS_PACKAGE_KEY = "content-section";
+// /**
+// * Dispatcher class for CMS (needed to be assigned to a legacy application).
+// */
+// private final static String CMS_DISPATCHER_CLASS =
+// "com.arsdigita.cms.dispatcher.ContentSectionDispatcher";
+
// /**
// * Constant string used as key for creating Workspace (content-center) as a
// * legacy application.
// */
// public static final String WORKSPACE_PACKAGE_KEY = "content-center";
- private static final String WORKSPACE_INSTANCE_NAME = "Content Center";
- /**
- * Dispatcher class for Workspace (content-center) (needed to be assigned
- * to a legacy application).
- */
- private static final String WORKSPACE_DISPATCHER_CLASS =
- "com.arsdigita.cms.dispatcher.ContentCenterDispatcher";
- // To be updated soon...
- // "com.arsdigita.dispatcher.DefaultPackageDispatcher";
-
+// private static final String WORKSPACE_INSTANCE_NAME = "Content Center";
// /**
-// * Stylesheet which has to be assigned as part of a legacy application
-// * creation.
+// * Dispatcher class for Workspace (content-center) (needed to be assigned
+// * to a legacy application).
// */
-// private final static String WORKSPACE_STYLESHEET =
-// "/packages/content-section/xsl/content-center.xsl";
- /**
- * Name of the CMS service package instance, i.e. its URL.
- */
- private final static String SERVICE_URL = "cms-service";
+// private static final String WORKSPACE_DISPATCHER_CLASS =
+// "com.arsdigita.cms.dispatcher.ContentCenterDispatcher";
+// // To be updated soon...
+// // "com.arsdigita.dispatcher.DefaultPackageDispatcher";
+
+// No longer used, moved to class Service
+// /**
+// * Name of the CMS service package instance, i.e. its URL.
+// */
+// private final static String SERVICE_URL = "cms-service";
// /**
// * Constant string used as key for creating service package as a
// * legacy application.
// */
// public final static String SERVICE_PACKAGE_KEY = "cms-service";
+
+ /**
+ *
+ */
private ArrayList m_content_type_list = new ArrayList();
/**
@@ -151,6 +167,8 @@ public class Loader extends PackageLoader {
public Loader() {
s_log.debug("CMS.loader (Constructor) invoked");
+ register(m_contentSectionNames);
+
s_log.debug("CMS.loader (Constructor) completed");
}
@@ -162,13 +180,6 @@ public class Loader extends PackageLoader {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
- // 1 - step 1a) Setup the CMS (content section) package type.
- // Uses old style application setup kernel.Package and Sitenode.
- // It is not needed, this step is included in new style setup
- // of content section (see below). It is here for reference
- // purpose during migration of the whole CMS to new style.
- // loadCMSPackageType();
-
// 2 - step 1b) Setup the Workspace package.
// loadWorkspacePackage(); // using old stype
// new style:
@@ -187,7 +198,7 @@ public class Loader extends PackageLoader {
// purpose during migration of the whole CMS to new style.
// loadContentCenterMapping(s_conf.getContentCenterMap() );
- // 5) load content type definition(s)
+ // 5) load (cms internal) content type definition(s)
// Used to be step 2 in former enterprise.init file
loadContentTypeDefinitions(s_conf.getCTDefFiles());
@@ -197,7 +208,7 @@ public class Loader extends PackageLoader {
// Implemented by
// com.arsdigita.cms.installer.SectionInitializer
// Loads content section application type and instance in one step
- loadContentSection(s_conf.getContentSectionName());
+ loadContentSection( (String[]) get(m_contentSectionNames) );
// Loading CMS portlets
// Used to be step 7 (last step) in former enterprise.init
@@ -218,106 +229,6 @@ public class Loader extends PackageLoader {
}.run();
}
-// Migration Status:
-// Method completely replaced by loadContentSection()
-// Code kept for reference purpose untill the complete migration will be done.
-//
-// /**
-// * Loads the CMS package type in the database, i.e. content-section,
-// * the main CMS domain (application) class.
-// *
-// * (pb) WRONG:
-// * Creates content-section PackageType. Is replaced by newer ApplicationType
-// * mechanisam (see loadContentSection). Must nolonger be used.
-// * 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() {
-// s_log.debug("Loading the CMS package type...");
-//
-// // creating appl. type using the deprecated legacy application style.
-// // Should be refactored to c.ad.web.Application.
-// // CMS_PACKAGE_KEY = "content-section"
-// PackageType type = PackageType.create
-// (CMS_PACKAGE_KEY,
-// "Content Management System",
-// "Content Management Systems",
-// "http://cms-java.arsdigita.com/");
-//
-// type.setDispatcherClass(CMS_DISPATCHER_CLASS);
-// //type.addListener(LISTENER_CLASS); (commented out)
-//
-// // Register a stylesheets to the CMS package.
-// Stylesheet ss = Stylesheet.createStylesheet(CMS_STYLESHEET);
-// ss.save();
-// type.addStylesheet(ss);
-// type.save();
-//
-//
-// Creating of CMS package using new style c.ad.web.Application could
-// be done like the following.
-// ApplicationType type = ApplicationType
-// .createApplicationType(ContentSection.PACKAGE_TYPE,
-// "Conten Management Application (i.e. content-section)",
-// ContentSection.BASE_DATA_OBJECT_TYPE);
-// type.setDescription("The content management application.");
-// // Question: Do we need to use deprectated (with no replacement) method
-// // setDispatcherClass in web.Application or does it work magically without?
-// type.setDispatcherClass(CMS_DISPATCHER_CLASS);
-// type.addStylesheet(ss);
-//
-//
-// createPrivileges();
-//
-// s_log.debug("Done creating the CMS package type.");
-// }
-// /**
-// * Loads and instantiates the Workspace package (content-center) in the
-// * database using old style application.
-// * Will be replaced by new style application in the migration process,
-// */
-/*
- private void loadWorkspacePackage() {
- s_log.debug("Creating CMS Workspace...");
-
- // from WorkspaceInstaller workspaceInstaller = new WorkspaceInstaller();
- try {
- // workspaceInstaller.createPackageType();
- PackageType type = PackageType.create(CMS.WORKSPACE_PACKAGE_KEY,
- "Content Center",
- "Content Centers",
- "http://cms-workspace.arsdigita.com/");
- type.setDispatcherClass(WORKSPACE_DISPATCHER_CLASS);
- type.save();
-
- // from PackageInstance instance = workspaceInstaller.createPackageInstance();
- // Does the following:
- type = PackageType.findByKey(CMS.WORKSPACE_PACKAGE_KEY);
- PackageInstance instance = type.createInstance(WORKSPACE_INSTANCE_NAME);
- instance.save();
-
- // from: workspaceInstaller.mountPackageInstance(instance, m_workspaceURL);
- // Does the following:
- // We really don't want it configurable.
- // SiteNode node = SiteNode.createSiteNode(CMS.WORKSPACE_PACKAGE_KEY,
- // SiteNode.getRootSiteNode());
- SiteNode node = SiteNode.createSiteNode(CMS.WORKSPACE_PACKAGE_KEY,
- SiteNode.getRootSiteNode());
- node.mountPackage(instance);
- node.save();
-
- // m_workspaceURL == WORKSPACE_PACKAGE_KEY
- // workspaceInstaller.mountPackageInstance(instance, m_workspaceURL);
- // workspaceInstaller.mountPackageInstance(instance, CMS.WORKSPACE_PACKAGE_KEY);
-
- } catch (DataObjectNotFoundException e) {
- throw new ConfigError(
- "Failed to initialize the Workspace package: ");
- }
-
- }
-*/
/**
* Loads and instantiates the Workspace package (content-center) in the
* database.
@@ -374,46 +285,12 @@ public class Loader extends PackageLoader {
null); // parent
app.setDescription("The default CMS workspace instance.");
app.save();
- s_log.warn("CMS Workspace instance created.");
+ s_log.warn("CMS Workspace instance " + Workspace.PACKAGE_KEY + " created.");
s_log.debug("Done loading CMS Workspace.");
}
-// /**
-// * CMS Service application is used by the Content Management System as a
-// * store for global resources and assets.
-// * Using old style application, will be replaced by new style in the
-// * migration process.
-// */
-/* private void loadServicePackage() {
- s_log.debug("Loading CMS Servce Package...");
-
- try {
- // from ServiceInstaller.createPackageType();
- PackageType type = PackageType.create(CMS.SERVICE_PACKAGE_KEY,
- "Content Management System Services",
- "Content Management System Services",
- "http://cms-service.arsdigita.com/");
- type.setDispatcherClass(
- "com.arsdigita.cms.dispatcher.ServiceDispatcher");
- type.save();
-
- // from PackageInstance instance = ServiceInstaller.createPackageInstance();
- type = PackageType.findByKey(CMS.SERVICE_PACKAGE_KEY);
- PackageInstance instance = type.createInstance(CMS.SERVICE_PACKAGE_KEY);
- instance.save();
-
- // from ServiceInstaller.mountPackageInstance(instance, url);
- SiteNode node = SiteNode.createSiteNode(SERVICE_URL,
- SiteNode.getRootSiteNode());
- node.mountPackage(instance);
- node.save();
-
- } catch (DataObjectNotFoundException e) {
- throw new ConfigError("Failed to initialize CMS global services package.");
- }
- }
-*/
+
/**
* CMS Service application is used by the Content Management System as a
* store for global resources and assets.
@@ -473,23 +350,26 @@ public class Loader extends PackageLoader {
s_log.debug("Done creating CMS Service Package.");
}
+
/**
- * Load an content section application type and an initial default
- * content-section instance as specified in LoaderConfig.
+ * Load a content section application type and an initial default
+ * content-section instance(s).
+ * Some configuration values which are to be considered as unmutable are
+ * specified in LoaderConfig.
* Uses new style application in legacy compatible mode.
*
+ * NOTE: At ccm-cms load time no content type packages are available because
+ * any content type depends on ccm-cms. Therefore, the loading step can not
+ * process content type package assignment! Instead each content type itself
+ * must assign itself to an apropriate content section at it's load time.
+ * Cf. {@link com.arsdigita.cms.contenttype.AbstractContentTypeLoader}.
+ *
+ * But the load step has to process the cms internal content types!
*/
- private void loadContentSection(String name) {
+ private void loadContentSection(String[] sectionNames) {
- s_log.info("Creating content section on /" + name);
-
- // Step 1: Validate name for section
- Util.validateURLParameter("name", name);
-
- // Step 2: Creating content section application type first so that
- // concrete content-section instance can be created.
- // from: ContentSectionSetup.setupContentSectionAppType();
- // Install application type using new application classes
+ // Step 1: Create content section application type
+ // prerequisite for concrete content-section instance creation.
ApplicationSetup appType = new ApplicationSetup(s_log);
appType.setApplicationObjectType(ContentSection.BASE_DATA_OBJECT_TYPE);
appType.setKey(ContentSection.PACKAGE_TYPE); // by default: content-section
@@ -511,75 +391,94 @@ public class Loader extends PackageLoader {
appType.run();
- // Step 3:
+ // Step 2: Load CMS specific privileges into central (core) privilege
+ // system.
createPrivileges();
- // Step 4: Create the installation default content section "name"
+ // Step 3: Create the installation default content section(s).
// ContentSection.create creates a section with several default values
// which have to be adopted for a concrete installation.
- ContentSection section = ContentSection.create(name);
- // ContentSectionSetup is a convenient class to adopt a section created
- // by ContentSection.create()
- ContentSectionSetup setup = new ContentSectionSetup(section);
+ for (int i = 0 ; i < sectionNames.length ; i++) {
+
+ final String sectionName = sectionNames[i];
+ s_log.warn("Creating content section on /" + sectionName);
- // ContentSection.create uses the following properties:
- // Name, see above
- // Root & template folder, set autonomously by ContentSection.create()
+ // Step 1: Validate name for section
+ Util.validateURLParameter("name", sectionName);
+
+ // Step 2: Create a section using default values
+ ContentSection section = ContentSection.create(sectionName);
+
+ // Step 3: Adopt the created section to site specific requirements
+ // ContentSectionSetup is a convenient class to adopt a
+ // section created by ContentSection.create()
+ ContentSectionSetup setup = new ContentSectionSetup(section);
- // Roles (staff group) used in content section. Register roles using
- // a complete set of default roles defined in ContentSectionSetup
- setup.registerRoles(s_conf.getStuffGroup());
+ // Step 3a: Roles (staff group) used in this content section.
+ // Register roles using a complete set of default roles
+ // defined in ContentSectionSetup
+ setup.registerRoles(s_conf.getStuffGroup());
- // ViewerGroup populated in ContentSection, public access is determined
- // by parameter (affecting characteristics of the viewer group)
- setup.registerViewers(s_conf.isPubliclyViewable());
+ // ViewerGroup populated in ContentSection, public access is determined
+ // by parameter (affecting characteristics of the viewer group)
+ setup.registerViewers(s_conf.isPubliclyViewable());
- // Page resolver class, set autonomously by ContentSection.create()
- // Item resolver class, configurable, defaults in place.
- // Template resolver class, configurable, defaults in place.
- // We should not overwrite the default in the initial default configuration
+ // Page resolver class, set autonomously by ContentSection.create()
+ // Item resolver class, configurable, defaults in place.
+ // Template resolver class, configurable, defaults in place.
+ // We should not overwrite the default in the initial default configuration
- // register a predefined one-phase lifecycle for items.
- setup.registerPublicationCycles();
- // registers predefined "Authoring", "Approval", "Publishing' steps
- setup.registerWorkflowTemplates();
- setup.registerResolvers(s_conf.getItemResolverClass(),
- s_conf.getTemplateResolverClass());
- // XML generator class, set autonomously by ContentSection.create()
+ // register a predefined one-phase lifecycle for items.
+ setup.registerPublicationCycles();
+ // registers predefined "Authoring", "Approval", "Publishing' steps
+ setup.registerWorkflowTemplates();
+ setup.registerResolvers(s_conf.getItemResolverClass(),
+ s_conf.getTemplateResolverClass());
+ // XML generator class, set autonomously by ContentSection.create()
- setup.registerContentTypes(m_content_type_list);
- setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
- // Section specific categories, usually not used.
- // During initial load at install time nor used at all!
- // default value is false so no categories get loaded.
- if (s_conf.getUseSectionCategories()) {
- Iterator files = ((List) s_conf.getCategoryFileList()).iterator();
- while (files.hasNext()) {
- setup.registerCategories((String) files.next());
+ /* Register internal base content types. Paramter is a list of
+ * class names created by internal content type load method.
+ * @see loadContentTypeDefinitions(List) */
+ setup.registerContentTypes(m_content_type_list);
+
+ // See method doc above. No external content types available at
+ // cms load time,
+ // setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
+
+ // Section specific categories, usually not used.
+ // During initial load at install time nor used at all!
+ // default value is false so no categories get loaded.
+ if (s_conf.getUseSectionCategories()) {
+ Iterator files = ((List) s_conf.getCategoryFileList()).iterator();
+ while (files.hasNext()) {
+ setup.registerCategories((String) files.next());
+ }
}
+
+ // registers a predefined standard recipient for alerts
+ setup.registerAlerts();
+
+ // Load a list of cms tasks and associated alert events
+ // Currently no functionality to persist them. Not a loader task yet
+ // setup.loadTaskAlerts(s_conf.getTaskAlerts());
+
+ section.save(); //persists any changes in the database (DomainObject)
+ //i.e. creates an object (instance)
}
- // registers a predefined standard recipient for alerts
- setup.registerAlerts();
-
- // Load a list of cms tasks and associated alert events
- // Currently no functionality to persist them. Not a loader task yet
- // setup.loadTaskAlerts(s_conf.getTaskAlerts());
-
- section.save(); //persists any changes in the database (DomainObject)
- //i.e. creates an object (instance)
-
}
/**
- * 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.
+ * Parses XML file definition of (internal) base content types and loads
+ * them into database. It fulfills a task similiar to the Loader of external
+ * content type packages.
+ *
+ * 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.
*
* UDCT Copyright
*
diff --git a/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java b/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java
index a953679d7..eeed7c0d4 100644
--- a/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java
+++ b/ccm-cms/src/com/arsdigita/cms/LoaderConfig.java
@@ -31,11 +31,20 @@ import java.util.ArrayList;
import org.apache.log4j.Logger;
+// IMPLEMENTATION NOTE
+// Class is a result of migrating the old enterprise.init based
+// initialization process and not yet completed. Functionality is
+// basically OK so far, but code urgently needs cleaning up and a
+// check for useful bits.
+
+
/**
- * Module enables administrators to configure some features of the CMS application
- * at install time. It is read in and processed only once and configuration is
- * persisted in database. Currently there is no way to alter these features
- * later after the installation step.
+ * Container for various configuration parameters for ccm-cms package loader.
+ *
+ * The parameters are basically immutable for users and administrators and only
+ * accessible to developers and require recompilation. Specifying any of these
+ * parameters during installation takes no effect at all! Parameters which have
+ * to be modifiable must be included in Loader class itself!
*
* @author pb
* @version $Id: LoaderConfig.java $
@@ -56,16 +65,11 @@ public final class LoaderConfig extends AbstractConfig {
public static synchronized LoaderConfig getInstance() {
if (s_conf == null) {
s_conf = new LoaderConfig();
- /* Currently LoaderConfig does not process parameters stored in a
- * properties file. In order to do so the class must be added to
- * ccm-cms.config, a storage file specified and the load() commented
- * in.
- * Before it can be used meaningfully, ccm-xxx-aplaws must be enhanced
- * to be able tp process dynamically e.g. section name and other
- * parameter values. Currently, section name is hardcoded (content) as
- * well as creating terms domains etc.
+ /* Parameters are not stored in registry nor modified by installation
+ * specification. It is not possible to process a config object at
+ * Load time!
+ * s_conf.load();
*/
- // s_conf.load();
}
return s_conf;
@@ -125,23 +129,26 @@ public final class LoaderConfig extends AbstractConfig {
// s_log.debug("Set cache items to " + cacheItems);
// ItemDispatcher.setCacheItems(cacheItems);
- // /////////////////////////////////////////////////////
- // Following parameter is used by c.ad.cms.installer.xml
- // to load definition(s) of content types to database.
- // (Definitions describe sections to be included in
- // authoring steps).
- // /////////////////////////////////////////////////////
/**
- * List of Paths to XML files that contain content type definition(s).
+ * Comma separated list of XML definition files for internal content types
+ * (base types).
+ *
+ * Each internal content type (see package com/arsdigita/cms/contenttypes)
+ * requires an entry in this list in order to get CMS Loader to load it
+ * into permanent storage (equivalent to the Loader of each external
+ * content type package).
+ *
+ * Each definition file name has to be fully qualified relative to
+ * application (context) root.
* Example:
* contentTypeDefinitions = { "/WEB-INF/content-types/Template.xml" };
- * An entry in this list is required by internal content types (see package
- * ccm-cms/src/com/arsdigita/cms/contenttypes)
+ *
+ * This parameter should be altered only by developers!
*/
private final Parameter m_ctDefFiles =
new StringArrayParameter(
- "com.arsdigita.cms.loader.contenttype_definition_files",
+ "com.arsdigita.cms.loader.internal_cts",
Parameter.REQUIRED,
// Generic*.xml added by Quasi in enterprise.init for
// new generic Basetypes in addition to article
@@ -163,16 +170,8 @@ public final class LoaderConfig extends AbstractConfig {
// ///////////////////////////////////////////////////////////////////////
- /**
- * The name of the content section, the default value used for initial
- * setup.
- */
- private final Parameter
- m_contentSectionName = new StringParameter(
- "com.arsdigita.cms.loader.section_name",
- Parameter.REQUIRED,
- "content");
-
+ // Section Name, configured by Loader parameter
+
// Root Folder, set autonomously by ContentSection.create() method
// Template Folder, set autonomously by ContentSection.create() method
@@ -224,12 +223,16 @@ public final class LoaderConfig extends AbstractConfig {
* When the list is empty and the first default content section is created,
* all installed content types will get registered. This behaviour should
* not be altered without very good reasons.
+ *
+ * While loading ccm-cms no external content type packages are available
+ * because all content types depend on ccm-cms. Therefore this parameter
+ * can not beused in loader context.
*/
- private final Parameter
- m_contentTypeList = new StringArrayParameter(
- "com.arsdigita.cms.loader.section_ctypes_list",
- Parameter.REQUIRED,
- new String[] {} );
+ //private final Parameter
+ // m_contentTypeList = new StringArrayParameter(
+ // "com.arsdigita.cms.loader.section_ctypes_list",
+ // Parameter.REQUIRED,
+ // new String[] {} );
// Page Resolver Class, set autonomously by ContentSection.create() method.
@@ -310,7 +313,6 @@ public final class LoaderConfig extends AbstractConfig {
// new String[] {"/WEB-INF/resources/article-categories.xml",
// "/WEB-INF/resources/navigation-categories.xml"} );
-
/** List of widgets used in applications forms. Each widget is described by
application indicator, widget name (singular & plural), model class name
and model ui class name. These are really not user or administrator
@@ -486,12 +488,11 @@ public final class LoaderConfig extends AbstractConfig {
register(m_ctDefFiles);
// Parameters for creating a content section
- register(m_contentSectionName);
register(m_isPublic);
register(m_itemResolverClass);
register(m_templateResolverClass);
- register(m_contentTypeList);
+ // register(m_contentTypeList);
register(m_useSectionCategories);
register(m_categoryFileList);
@@ -504,9 +505,7 @@ public final class LoaderConfig extends AbstractConfig {
// register(m_overdueAlertInterval);
// register(m_maxAlerts);
-
-
-
+ // Does not work at load time!
// loadInfo();
}
@@ -542,12 +541,6 @@ public final class LoaderConfig extends AbstractConfig {
}
- /**
- * Retrieve the name of the content-section
- */
- public String getContentSectionName() {
- return (String) get(m_contentSectionName);
- }
/**
@@ -694,9 +687,9 @@ public final class LoaderConfig extends AbstractConfig {
/**
* Retrieve the
*/
- public List getContentSectionsContentTypes() {
- String[] contentTypes = (String[]) get(m_contentTypeList);
- return Arrays.asList(contentTypes);
- }
+// public List getContentSectionsContentTypes() {
+// String[] contentTypes = (String[]) get(m_contentTypeList);
+// return Arrays.asList(contentTypes);
+// }
}
diff --git a/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties
index 42a3c4564..65d32c697 100644
--- a/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties
+++ b/ccm-cms/src/com/arsdigita/cms/LoaderConfig_parameter.properties
@@ -13,11 +13,6 @@ com.arsdigita.cms.loader.contenttype_definition_files.purpose=
com.arsdigita.cms.loader.contenttype_definition_files.example=
com.arsdigita.cms.loader.contenttype_definition_files.format=[StringArray]
-com.arsdigita.cms.loader.section_name.title=
-com.arsdigita.cms.loader.section_name.purpose=
-com.arsdigita.cms.loader.section_name.example=
-com.arsdigita.cms.loader.section_name.format=[StringArray]
-
com.arsdigita.cms.loader.section_staff_group.title=
com.arsdigita.cms.loader.section_staff_group.purpose=
com.arsdigita.cms.loader.section_staff_group.example=
diff --git a/ccm-cms/src/com/arsdigita/cms/Loader_parameter.properties b/ccm-cms/src/com/arsdigita/cms/Loader_parameter.properties
new file mode 100755
index 000000000..14fce55d7
--- /dev/null
+++ b/ccm-cms/src/com/arsdigita/cms/Loader_parameter.properties
@@ -0,0 +1,6 @@
+com.arsdigita.cms.loader.section_name.title= Name(s) of content section(s)
+com.arsdigita.cms.loader.section_name.purpose=One ore more content section names to create
+com.arsdigita.cms.loader.section_name.example=content[,generic]
+com.arsdigita.cms.loader.section_name.format=[StringArray]
+
+
diff --git a/ccm-cms/src/com/arsdigita/cms/Service.java b/ccm-cms/src/com/arsdigita/cms/Service.java
index 4a7a34795..34b38238c 100644
--- a/ccm-cms/src/com/arsdigita/cms/Service.java
+++ b/ccm-cms/src/com/arsdigita/cms/Service.java
@@ -30,6 +30,9 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger;
// WORK IN PROGRESS !!
+// Currentliy just a minimal implementation ready to switch cms-service from an
+// old style package-type application to a new style legacy compatible
+// application based an classes web.Application etc.
/**
* Application domain class for the CMS Service application, a CMS module which
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java b/ccm-cms/src/com/arsdigita/cms/contentitem/ContentBundleHelper.java
similarity index 99%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java
rename to ccm-cms/src/com/arsdigita/cms/contentitem/ContentBundleHelper.java
index 30f1a5d4c..1cb7855c6 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentBundleHelper.java
+++ b/ccm-cms/src/com/arsdigita/cms/contentitem/ContentBundleHelper.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contentitem;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java b/ccm-cms/src/com/arsdigita/cms/contentitem/ContentItemHelper.java
similarity index 99%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java
rename to ccm-cms/src/com/arsdigita/cms/contentitem/ContentItemHelper.java
index ce289719d..bb3d1a284 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentItemHelper.java
+++ b/ccm-cms/src/com/arsdigita/cms/contentitem/ContentItemHelper.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contentitem;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentPageHelper.java b/ccm-cms/src/com/arsdigita/cms/contentitem/ContentPageHelper.java
similarity index 99%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentPageHelper.java
rename to ccm-cms/src/com/arsdigita/cms/contentitem/ContentPageHelper.java
index 815e34aeb..6790b9ae1 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentPageHelper.java
+++ b/ccm-cms/src/com/arsdigita/cms/contentitem/ContentPageHelper.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contentitem;
import com.arsdigita.categorization.Category;
import com.arsdigita.categorization.CategoryPurpose;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/GenericArticleHelper.java b/ccm-cms/src/com/arsdigita/cms/contentitem/GenericArticleHelper.java
similarity index 94%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/GenericArticleHelper.java
rename to ccm-cms/src/com/arsdigita/cms/contentitem/GenericArticleHelper.java
index 21d1fb65b..15b9f5e6d 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/GenericArticleHelper.java
+++ b/ccm-cms/src/com/arsdigita/cms/contentitem/GenericArticleHelper.java
@@ -16,8 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contentitem;
+import com.arsdigita.cms.contentitem.ContentPageHelper;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.TextAsset;
import com.arsdigita.cms.contenttypes.GenericArticle;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentItemHandler.java b/ccm-cms/src/com/arsdigita/cms/contentitem/XMLContentItemHandler.java
similarity index 99%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentItemHandler.java
rename to ccm-cms/src/com/arsdigita/cms/contentitem/XMLContentItemHandler.java
index 6875db236..6fd2d33b8 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentItemHandler.java
+++ b/ccm-cms/src/com/arsdigita/cms/contentitem/XMLContentItemHandler.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contentitem;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
@@ -29,6 +29,7 @@ import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.util.Assert;
import com.arsdigita.util.StringUtils;
import com.arsdigita.util.UncheckedWrapperException;
+
import java.lang.reflect.Constructor;
import java.util.Hashtable;
import java.util.Iterator;
@@ -36,11 +37,14 @@ import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.Vector;
+
import org.apache.log4j.Logger;
import org.apache.oro.text.perl.Perl5Util;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
+
+
/**
* Parses and XML file definition of content items in a folder.
* the XML configuration should look like this:
@@ -81,8 +85,8 @@ import org.xml.sax.helpers.DefaultHandler;
* </ccm:item-properties>
*
* <ccm:content-item
- * helperClass="com.arsdigita.cms.installer.xml.ContentBundleHelper"
- * association-name="birdWatch" >
+ * helperClass="com.arsdigita.cms.installer.xml.ContentBundleHelper"
+ * association-name="birdWatch" >
* <!-- Nested ContentItems (nested within another content-item)
* are created and associated with the encapsulating item.
* These are defined as regular content-items, except for a
@@ -101,8 +105,6 @@ import org.xml.sax.helpers.DefaultHandler;
*
*
*/
-
-
public class XMLContentItemHandler extends DefaultHandler {
private static final Logger s_log
= Logger.getLogger(XMLContentItemHandler.class);
@@ -140,6 +142,7 @@ public class XMLContentItemHandler extends DefaultHandler {
}
+ @Override
public void startElement( String uri, String name,
String qName, Attributes atts) {
@@ -160,7 +163,7 @@ public class XMLContentItemHandler extends DefaultHandler {
currFolderTree.addSubTree ( newFolderTree );
currFolderTree = newFolderTree;
- m_folder = (Folder) currFolderTree.getFolderHelper().createContentItem ( true );
+ m_folder = (Folder) currFolderTree.getFolderHelper().createContentItem(true );
} else if ( qName.equals(CONTENT_ITEM)) {
/*
@@ -224,6 +227,7 @@ public class XMLContentItemHandler extends DefaultHandler {
}
}
+ @Override
public void characters(char[] ch,
int start,
int length) {
@@ -231,6 +235,7 @@ public class XMLContentItemHandler extends DefaultHandler {
m_body = new String(ch, start, length);
}
+ @Override
public void endElement( String uri, String name,
String qName) {
diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java
index eb170d80a..df4f18d1a 100644
--- a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java
+++ b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionSetup.java
@@ -33,7 +33,6 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.cms.workflow.CMSTask;
import com.arsdigita.cms.workflow.CMSTaskType;
import com.arsdigita.domain.DataObjectNotFoundException;
-//import com.arsdigita.initializer.InitializationException;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.PartyCollection;
import com.arsdigita.kernel.Role;
@@ -72,7 +71,6 @@ import org.xml.sax.helpers.DefaultHandler;
public final class ContentSectionSetup {
private static Logger s_log = Logger.getLogger(ContentSectionSetup.class);
- private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
private HashMap m_tasks = new HashMap();
private LifecycleDefinition m_lcd;
private WorkflowTemplate m_wf;
@@ -457,6 +455,11 @@ public final class ContentSectionSetup {
return type;
}
+ /**
+ *
+ * @param type
+ * @param filename
+ */
void registerTemplate(ContentType type, String filename) {
// Use the base of the file name (ie without path & extension)
// as the template name
@@ -675,5 +678,7 @@ public final class ContentSectionSetup {
m_cats.pop();
}
}
- }
+ } // END private class CategoryHandler
+
+
}
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java
index 0cf61e5de..450f86ad1 100755
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/AbstractContentTypeLoader.java
@@ -25,7 +25,6 @@ import com.arsdigita.cms.ContentTypeWorkflowTemplate;
import com.arsdigita.cms.Template;
import com.arsdigita.cms.TemplateManager;
import com.arsdigita.cms.TemplateManagerFactory;
-import com.arsdigita.cms.installer.xml.XMLContentTypeHandler;
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
import com.arsdigita.domain.DomainObjectFactory;
@@ -60,19 +59,30 @@ import org.apache.log4j.Logger;
**/
public abstract class AbstractContentTypeLoader extends PackageLoader {
+ /** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(
- AbstractContentTypeLoader.class);
+ AbstractContentTypeLoader.class);
+ /**
+ *
+ * @param ctx
+ */
public void run(final ScriptContext ctx) {
new KernelExcursion() {
protected void excurse() {
setEffectiveParty(Kernel.getSystemParty());
+
createTypes(ctx);
+
}
}.run();
}
+ /**
+ *
+ * @param ctx
+ */
private void createTypes(ScriptContext ctx) {
XMLContentTypeHandler handler = new XMLContentTypeHandler();
String[] contentTypes = getTypes();
@@ -83,10 +93,12 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
List types = handler.getContentTypes();
Session ssn = ctx.getSession();
DataCollection sections = ssn.retrieve(
- ContentSection.BASE_DATA_OBJECT_TYPE);
+ ContentSection.BASE_DATA_OBJECT_TYPE);
while (sections.next()) {
- ContentSection section = (ContentSection) DomainObjectFactory.newInstance(sections.getDataObject());
+ ContentSection section = (ContentSection)
+ DomainObjectFactory.newInstance(
+ sections.getDataObject());
if (!isLoadableInto(section)) {
continue;
}
@@ -128,6 +140,9 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
protected abstract String[] getTypes();
+ /*
+ *
+ */
private boolean isLoadableInto(ContentSection section) {
if (section == null) {
throw new NullPointerException("section");
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentTypeHelper.java
similarity index 98%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java
rename to ccm-cms/src/com/arsdigita/cms/contenttypes/ContentTypeHelper.java
index 20215272f..c7b88d0ea 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelper.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentTypeHelper.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.ContentType;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentTypeHelperImpl.java
similarity index 99%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java
rename to ccm-cms/src/com/arsdigita/cms/contenttypes/ContentTypeHelperImpl.java
index 1915d1c70..f18fd73df 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ContentTypeHelperImpl.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.AuthoringStep;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/UDCTHelper.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/UDCTHelper.java
similarity index 94%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/UDCTHelper.java
rename to ccm-cms/src/com/arsdigita/cms/contenttypes/UDCTHelper.java
index 39b93bb1c..08cd44ee4 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/UDCTHelper.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/UDCTHelper.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.AuthoringStep;
@@ -37,6 +37,10 @@ import org.apache.oro.text.perl.Perl5Util;
import java.math.BigDecimal;
+/**
+ *
+ *
+ */
public class UDCTHelper extends ContentTypeHelperImpl implements ContentTypeHelper {
private static final Logger s_log
= Logger.getLogger(UDCTHelper.class);
@@ -54,6 +58,10 @@ public class UDCTHelper extends ContentTypeHelperImpl implements ContentTypeHelp
private int m_stepCount = 1;
// Flag to avoid the duplication of categorization step
private boolean m_hasCategoryStep = false;
+
+ /**
+ * Constructor
+ */
public UDCTHelper() {
// this is predefined
setCreateComponent(CREATION_COMPONENT);
@@ -88,6 +96,11 @@ public class UDCTHelper extends ContentTypeHelperImpl implements ContentTypeHelp
}
}
+ /**
+ *
+ * @return
+ */
+ @Override
public AuthoringKit createAuthoringKit() {
setCreateComponent(CREATION_COMPONENT);
AuthoringKit kit = super.createAuthoringKit();
@@ -96,12 +109,21 @@ public class UDCTHelper extends ContentTypeHelperImpl implements ContentTypeHelp
return kit;
}
+ /**
+ *
+ * @return
+ */
private DynamicObjectType createDOT() {
DynamicObjectType dot = new DynamicObjectType(m_name, m_parentType);
dot.save();
return dot;
}
+ /**
+ *
+ * @return
+ */
+ @Override
public ContentType createType() {
MetadataRoot root = SessionManager.getMetadataRoot();
@@ -161,6 +183,14 @@ public class UDCTHelper extends ContentTypeHelperImpl implements ContentTypeHelp
m_type.save();
}
+ /**
+ *
+ * @param label
+ * @param description
+ * @param component
+ * @param ordering
+ */
+ @Override
public void addAuthoringStep(String label,
String description,
String component,
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/XMLContentTypeHandler.java
similarity index 99%
rename from ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java
rename to ccm-cms/src/com/arsdigita/cms/contenttypes/XMLContentTypeHandler.java
index d6d181b34..e50f15d0f 100755
--- a/ccm-cms/src/com/arsdigita/cms/installer/xml/XMLContentTypeHandler.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/XMLContentTypeHandler.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.installer.xml;
+package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.ContentType;
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java.nolongerInUse
deleted file mode 100755
index dfa1f6809..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/ContentCenterSetup.java.nolongerInUse
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.installer;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.initializer.InitializationException;
-import com.arsdigita.kernel.PackageInstance;
-import com.arsdigita.kernel.PackageType;
-// import com.arsdigita.kernel.Stylesheet;
-import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.apache.log4j.Logger;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-// Migration Status
-// All tasks this class used to perform are migrated to either cms.Loader or
-// cms.WorkspaceSetup.
-// File is kept in trunk for reference purpose until the whole migration process
-// will be completed. (2010-20-18)
-
-/**
- * Sets up the CMS package.
- *
- * @author Jon Orris (jorris@redhat.com)
- * @version $Revision: #10 $ $DateTime: 2004/08/17 23:15:09 $
- */
-public final class ContentCenterSetup {
-
- /** URL to access the CMS Workspace, by default content-center */
- final String m_workspaceURL;
-
- /** Map of URL stubs and resource handler classes for ContentCenterDispatcher
- * to use */
- final String m_contentCenterMap;
-
- /** Contains mapping of URL (key) to resource handler*/
- private static HashMap s_pageClasses = new HashMap();
-
- /** Contains mapping of resource(key) to resource handler */
- private static HashMap s_pageURLs = new HashMap();
-
-
- private final static String SERVICE_URL = "cms-service";
-
- private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
- private final static String PACKAGE_KEY = "content-section";
- private final static String DISPATCHER_CLASS =
- "com.arsdigita.cms.dispatcher.ContentSectionDispatcher";
-
-
- private static Logger s_log = Logger.getLogger(ContentSectionSetup.class);
-
-
- /**
- * Constructor
- *
- * @param workspaceURL
- * @param contentCenterMap
- */
- public ContentCenterSetup( String workspaceURL,
- String contentCenterMap) {
-
- m_workspaceURL = workspaceURL;
- m_contentCenterMap = contentCenterMap;
-
- }
-
- /** Gives you a mapping of URL (key) to resource handler
- * Use the returned map like so: map.get("search");
- */
- public static HashMap getURLToClassMap() {
- return s_pageClasses;
- }
-
- /** Gives you a mapping of resource(key) to resource handler
- * Use the returned map like so: map.get("com.arsdigita.cms.ui.WorkspacePage");
- */
- public static HashMap getClassToURLMap() {
- return s_pageURLs;
- }
-
- public void run() {
-
- // 1) Setup the content section package.
- // 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.
- // Moved to Loader
- // setupWorkspacePackage();
-
- // 3) Setup the CMS global services package.
- // Moved to Loader
- // setupServicePackage();
-
- // 8) Load the content-center page mappings
- // Has to be executed an each system startup and is an
- // Initializer task.
- setupContentCenter();
-
-
- }
-
- /**
- * Creates the CMS (i.e. content section) package type if it does not already exist.
- *
- * Actually: Creation ot content section is migrated to loader. Just used to
- * create privileges.
- */
- private static void setupCMSPackage() {
- if ( !PackageType.typeExists(Installer.PACKAGE_KEY) ) { //key = content-section
- s_log.info("Creating the CMS package type...");
-
-// PackageType type = PackageType.create
-// (PACKAGE_KEY, "Content Management System", "Content Management Systems",
-// "http://cms-java.arsdigita.com/");
-// type.setDispatcherClass(DISPATCHER_CLASS);
-// //type.addListener(LISTENER_CLASS);
-
- // Register a stylesheets to the CMS package.
-// Stylesheet ss = Stylesheet.createStylesheet(STYLESHEET);
-// ss.save();
-// type.addStylesheet(ss);
-// type.save();
-
- createPrivileges();
-
- s_log.info("Done creating the CMS package type.");
- }
- }
-
-
- /**
- * Creates and mounts the Workspace package.
- */
- private void setupWorkspacePackage() throws InitializationException {
- if ( !PackageType.typeExists((new WorkspaceInstaller()).getPackageKey())) {
- s_log.info("Initializing CMS Workspace...");
-
- Util.validateURLParameter("workspace", m_workspaceURL);
-
- WorkspaceInstaller workspaceInstaller = new WorkspaceInstaller();
- try {
- workspaceInstaller.createPackageType();
- PackageInstance instance = workspaceInstaller.createPackageInstance();
- workspaceInstaller.mountPackageInstance(instance, m_workspaceURL);
- } catch (DataObjectNotFoundException e) {
- throw new InitializationException
- ("Failed to initialize the Workspace package: ", e);
- }
-
- s_log.info("Done initializing CMS Workspace.");
- }
- }
-
- /**
- * Creates and mounts the CMS Service package.
- */
- private static void setupServicePackage() {
- if ( !PackageType.typeExists(ServiceInstaller.PACKAGE_KEY) ) {
- String url = SERVICE_URL;
-
- try {
- ServiceInstaller.createPackageType();
- PackageInstance instance = ServiceInstaller.createPackageInstance();
- ServiceInstaller.mountPackageInstance(instance, url);
- } catch (DataObjectNotFoundException e) {
- throw new InitializationException
- ("Failed to initialize CMS global services package: ", e);
- }
- }
- }
-
-
- /**
- * 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() {
-
- 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.warn(String.format("privilege = %s", privilege));
- if ( PrivilegeDescriptor.get(privilege) == null ) {
- PrivilegeDescriptor.createPrivilege(privilege);
- }
- }
-
- } finally {
- dq.close();
- }
- }
-
-
-
-
- /**
- * 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 {
- final PageClassConfigHandler handler
- = new PageClassConfigHandler(s_pageClasses, s_pageURLs);
-
- final ClassLoader loader = Thread.currentThread
- ().getContextClassLoader();
- final InputStream input = loader.getResourceAsStream
- (m_contentCenterMap.substring(1));
-
- if (input == null) {
- throw new IllegalStateException(m_contentCenterMap + " 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);
- }
- }
-
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java.nolongerInUse
deleted file mode 100755
index b6b84c4b5..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/ContentSectionSetup.java.nolongerInUse
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Copyright (C) 2003-2005 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.installer;
-
-import com.arsdigita.categorization.Category;
-import com.arsdigita.categorization.RootCategoryCollection;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ContentTypeLifecycleDefinition;
-import com.arsdigita.cms.ContentTypeWorkflowTemplate;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.Template;
-import com.arsdigita.cms.TemplateManagerFactory;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.cms.lifecycle.PhaseDefinition;
-import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.cms.workflow.CMSTask;
-import com.arsdigita.cms.workflow.CMSTaskType;
-import com.arsdigita.cms.workflow.UnfinishedTaskNotifier;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.initializer.InitializationException;
-import com.arsdigita.kernel.ACSObjectInstantiator;
-import com.arsdigita.kernel.Party;
-import com.arsdigita.kernel.PartyCollection;
-import com.arsdigita.kernel.Role;
-import com.arsdigita.kernel.permissions.PermissionService;
-import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
-import com.arsdigita.persistence.DataObject;
-// import com.arsdigita.runtime.AbstractConfig;
-import com.arsdigita.cms.LoaderConfig;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.UncheckedWrapperException;
-import com.arsdigita.web.ApplicationSetup;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import com.arsdigita.xml.XML;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Date;
-import java.util.EmptyStackException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.Timer;
-
-import org.apache.log4j.Logger;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Sets up the content section.
- *
- * @author Jon Orris (jorris@redhat.com)
- * @version $Revision: #17 $ $DateTime: 2004/08/17 23:15:09 $
- */
-
-public final class ContentSectionSetup {
-
- private static Logger s_log = Logger.getLogger(ContentSectionSetup.class);
-
- private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
- private HashMap m_tasks = new HashMap();
- private LifecycleDefinition m_lcd;
- private WorkflowTemplate m_wf;
- final ContentSection m_section;
-
- // Load main CMS configuration file
- private static final LoaderConfig s_conf = new LoaderConfig();
-
-
- /**
- * Constructor
- * @param section
- */
- public ContentSectionSetup(ContentSection section) {
- Assert.exists(section, ContentSection.class);
- m_section = section;
- }
-
-// public void run() {
-//
-// // 4) Mount content sections.
-//
-// }
-
- /**
- * Setup content section app type
- */
- // Nach bisherigen Erkenntnissen: Braucht nur einmal aufgerufen zu werden,
- // um den Typ in die Datenbank einzutragen, d.h. letztlich den Klassennamen
- // mit zugehörien Support Klassen zu registrieren. Damit kann die Klasse
- // noch nicht benutzt oder angesprochen werden. Dazu muss zumindest eine
- // Instanz des Typs erstellt werden, (d.h. eine content section, z.B. die
- // default section 'content'. Für einen Typ können im Prinzip mehrere
- // Instanzen geschaffen werden, die sich vor allem durch den Namen, d.h. die
- // URL, unter der sie angesprochen werden, unterscheiden.
- public static void setupContentSectionAppType() {
-
- // Install application type using new application classes
- ApplicationSetup setup = new ApplicationSetup(s_log);
- setup.setApplicationObjectType(ContentSection.BASE_DATA_OBJECT_TYPE);
- setup.setKey(ContentSection.PACKAGE_TYPE); // by default: content-section
- setup.setTitle("CMS Content Section");
- setup.setDescription("A CMS Content Section");
- setup.setPortalApplication(false);
- //setup.setDispatcherClass(ContentItemDispatcher.class.getName());
- setup.setStylesheet(STYLESHEET); // by default: /pack./c-s/xml/cms.xml
- // contains the xsl to generate the page
-
- setup.setInstantiator(new ACSObjectInstantiator() {
- @Override
- public DomainObject doNewInstance(DataObject dataObject) {
- return new ContentSection(dataObject);
- }
- });
-
- setup.run();
-
- }
-
- /**
- * setup content section app instance
- */
- public static void setupContentSectionAppInstance(String name,
- List categoryFileList,
- List staffGroup,
- Boolean isPubliclyViewable) {
-
- s_log.info("Creating content section on /" + name);
-
-
- ContentSection section = ContentSection.create(name);
-
- ContentSectionSetup setup = new ContentSectionSetup(section);
-
- // Setup the access controls
-
- // section specific categories, usually not used.
- // During initial load at install time nor used at all!
- if (ContentSection.getConfig().getUseSectionCategories()) {
- // Iterator files = ((List) m_conf.getParameter(CATEGORIES)).iterator();
- // Iterator files = s_conf.getCategoryFileList().iterator();
- Iterator files = categoryFileList.iterator();
- while ( files.hasNext() ) {
- setup.registerCategories((String) files.next());
- }
- }
-
- setup.registerRoles(staffGroup);
- // setup.registerViewers((Boolean)m_conf.getParameter(PUBLIC));
- setup.registerViewers(isPubliclyViewable);
- setup.registerAlerts();
- setup.registerPublicationCycles();
- setup.registerWorkflowTemplates();
- // setup.registerContentTypes((List)m_conf.getParameter(TYPES));
- setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
- // setup.registerResolvers
- // ((String) m_conf.getParameter(ITEM_RESOLVER_CLASS),
- // (String) m_conf.getParameter(TEMPLATE_RESOLVER_CLASS));
- setup.registerResolvers
- (s_conf.getItemResolverClass(),
- s_conf.getTemplateResolverClass());
- section.save();
-
- // return section;
-
- }
-
-
- /**
- *
- * @param filename
- */
- public void registerCategories(String filename) {
-
- if (filename == null) {
- s_log.info("not loading any categories");
- return;
- }
-
- s_log.info("loading categories from " + filename);
-
- XML.parseResource(filename, new CategoryHandler(m_section));
- }
-
-
- public void registerRoles(List roles) {
-
- Iterator i = roles.iterator();
- while (i.hasNext()) {
- List role = (List)i.next();
-
- String name = (String)role.get(0);
- String desc = (String)role.get(1);
- List privileges = (List)role.get(2);
- String task = (role.size() > 3 ? (String)role.get(3) : null);
-
- s_log.info("Creating role " + name);
-
-
- Role group = registerRole(
- name,
- desc,
- privileges);
-
- if (task != null)
- m_tasks.put(task, group);
- }
-
- }
-
- Role registerRole(String name,
- String desc,
- List privileges) {
- Role role = m_section.getStaffGroup().createRole(name);
- role.setDescription(desc);
- role.save();
-
- Iterator i = privileges.iterator();
- while (i.hasNext()) {
- String priv = (String)i.next();
- s_log.info("Granting privilege cms_" + priv);
-
- role.grantPermission(m_section,
- PrivilegeDescriptor.get("cms_" + priv));
-
- if (priv.equals(SecurityManager.CATEGORY_ADMIN) ||
- priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
- RootCategoryCollection coll = Category.getRootCategories(m_section);
- while (coll.next()) {
- if (priv.equals(SecurityManager.CATEGORY_ADMIN)) {
- role.grantPermission(coll.getCategory(),
- PrivilegeDescriptor.ADMIN);
- } else {
- role.grantPermission(coll.getCategory(),
- Category.MAP_DESCRIPTOR);
- }
- }
- }
- }
-
- return role;
- }
-
- public void registerResolvers(String itemResolverClass, String templateResolverClass) {
-
- if (itemResolverClass != null && itemResolverClass.length()>0) {
- m_section.setItemResolverClass(itemResolverClass);
- s_log.info("Registering " + itemResolverClass + " as the item resolver class");
- } else {
- m_section.setItemResolverClass
- (ContentSection.getConfig().getDefaultItemResolverClass().getName());
- s_log.info("Registering " + itemResolverClass + " as the item resolver class");
- }
- if (templateResolverClass != null && templateResolverClass.length()>0) {
- m_section.setTemplateResolverClass(templateResolverClass);
- s_log.info("Registering " + templateResolverClass +
- " as the template resolver class");
- } else {
- m_section.setTemplateResolverClass
- (ContentSection.getConfig().getDefaultTemplateResolverClass().getName());
- s_log.info("Registering " + templateResolverClass +
- " as the template resolver class");
- }
-
- m_section.save();
- }
-
- public void registerWorkflowTemplates()
- throws InitializationException {
-
- // The 3-step production workflow.
- WorkflowTemplate wf = new WorkflowTemplate();
- wf.setLabel( (String) GlobalizationUtil.globalize(
- "cms.installer.production_workflow").localize());
- wf.setDescription("A process that involves creating and approving content.");
- wf.save();
-
- CMSTask authoring = new CMSTask();
- authoring.setLabel((String) GlobalizationUtil.globalize(
- "cms.installer.authoring").localize());
- authoring.setDescription("Create content.");
- authoring.save();
-
-
- Role author = (Role)m_tasks.get("Authoring");
- if (author != null)
- authoring.assignGroup(author.getGroup());
-
- authoring.setTaskType(CMSTaskType.retrieve(CMSTaskType.AUTHOR));
- authoring.save();
-
- CMSTask approval = new CMSTask();
- approval.setLabel( (String) GlobalizationUtil.globalize(
- "cms.installer.approval").localize());
- approval.setDescription("Approve content.");
- approval.save();
- approval.addDependency(authoring);
- approval.save();
-
- Role approver = (Role)m_tasks.get("Approval");
- if (approver != null)
- approval.assignGroup(approver.getGroup());
-
- approval.setTaskType(CMSTaskType.retrieve(CMSTaskType.EDIT));
- approval.save();
-
-
- CMSTask deploy = new CMSTask();
- deploy.setLabel((String) GlobalizationUtil.globalize(
- "cms.installer.deploy").localize());
- deploy.setDescription("Deploy content.");
- deploy.save();
- deploy.addDependency(approval);
- deploy.save();
-
- Role publisher = (Role)m_tasks.get("Publishing");
- if (publisher != null)
- deploy.assignGroup(publisher.getGroup());
-
- deploy.setTaskType(CMSTaskType.retrieve(CMSTaskType.DEPLOY));
- deploy.save();
-
- wf.addTask(authoring);
- wf.addTask(approval);
- wf.addTask(deploy);
- wf.save();
-
- m_section.addWorkflowTemplate(wf);
- m_section.save();
-
- m_wf = wf;
- }
-
- public void registerViewers(Boolean pub) {
- Role viewers = m_section.getViewersGroup().createRole("Content Reader");
- viewers.setDescription("Can view published pages within this section");
- viewers.save();
-
- viewers.grantPermission(m_section,
- PrivilegeDescriptor.get("cms_read_item"));
-
-
- String email = Boolean.TRUE.equals(pub) ? "public@nullhost"
- : "registered@nullhost";
-
- Party viewer = retrieveParty(email);
- if (viewer == null)
- throw new InitializationException(
- (String) GlobalizationUtil.globalize(
- "cms.installer.cannot_find_group_for_email").localize() + email);
-
- s_log.info("Adding " + email + " to viewers role");
- viewers.getGroup().addMemberOrSubgroup(viewer);
- viewers.save();
- }
-
- Party retrieveParty(String email) {
- PartyCollection parties = Party.retrieveAllParties();
- parties.filter(email);
- if (parties.next()) {
- Party party = parties.getParty();
- parties.close();
- return party;
- }
- return null;
- }
-
- /**
- * For the content section to be created create a role whose member will
- * receive alerts.
- */
- public void registerAlerts() {
- Role alert = m_section.getStaffGroup().createRole("Alert Recipient");
- alert.setDescription("Receive alerts regarding expiration of pubished content");
- alert.save();
- }
-
- public void registerContentTypes(List types) {
-
- Iterator i = types.iterator();
-
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof String) {
- registerContentType((String)obj);
- } else {
- List list = (List)obj;
- String name = (String)list.get(0);
- String file = (String)list.get(1);
-
- ContentType type = registerContentType(name);
- registerTemplate(type, file);
- }
- }
- }
-
- ContentType registerContentType(String name) {
- ContentType type = null;
- try {
- type = ContentType.findByAssociatedObjectType(name);
- } catch (DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException(
- (String) GlobalizationUtil.globalize(
- "cms.installer.cannot_find_content_type").localize() + name, ex);
- }
-
- s_log.info("Adding type " + name + " to " + m_section.getDisplayName());
- m_section.addContentType(type);
-
- s_log.info("Setting the default lifecycle for " +
- name + " to " + m_lcd.getLabel());
- ContentTypeLifecycleDefinition.
- updateLifecycleDefinition(m_section, type, m_lcd);
- m_lcd.save();
-
- s_log.info("Setting the default workflow template for " + name +
- " to " + m_wf.getLabel());
- ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf);
- m_wf.save();
-
- return type;
- }
-
- void registerTemplate(ContentType type, String filename) {
- // Use the base of the file name (ie without path & extension)
- // as the template name
- int pos1 = filename.lastIndexOf("/");
- int pos2 = filename.lastIndexOf(".");
-
- if (pos2 == -1)
- pos2 = filename.length();
-
- String label = filename.substring(pos1+1,pos2);
-
- String typename = type.getClassName();
- int pos3 = typename.lastIndexOf(".");
- String name = typename.substring(pos3+1, typename.length()) + "-" + label;
-
- Template temp = new Template();
- temp.setContentSection(m_section);
- temp.setName(name);
- temp.setLabel(label);
- temp.setParent(m_section.getTemplatesFolder());
-
- final ClassLoader loader = Thread.currentThread
- ().getContextClassLoader();
- final InputStream stream = loader.getResourceAsStream
- (filename.substring(1));
-
- if (stream == null) {
- throw new IllegalStateException
- ((String) GlobalizationUtil.globalize
- ("cms.installer.cannot_find_file").localize() + filename);
- }
-
- final BufferedReader input = new BufferedReader
- (new InputStreamReader(stream));
-
- StringBuffer body = new StringBuffer();
- String line;
- for (;;) {
- try {
- line = input.readLine();
- } catch (IOException ex) {
- throw new UncheckedWrapperException(
- (String) GlobalizationUtil.globalize(
- "cms.installer.cannot_read_line_of_data").localize(), ex);
- }
- if (line == null)
- break;
-
- body.append(line);
- body.append("\n");
- }
-
- temp.setText(body.toString());
-
- temp.save();
-
- TemplateManagerFactory.getInstance()
- .addTemplate(m_section, type, temp, "public");
-
- temp.publish(m_lcd, new Date());
- // Dan said to comment this out
- // temp.getLifecycle().start();
- }
-
- public void registerPublicationCycles()
- throws InitializationException {
-
- // The feature lifecycle.
- LifecycleDefinition lcd = new LifecycleDefinition();
- lcd.setLabel( (String) GlobalizationUtil.globalize(
- "cms.installer.simple_publication").localize());
- lcd.setDescription("A one-phase lifecycle for items.");
- lcd.save();
-
- PhaseDefinition pd = lcd.addPhaseDefinition(
- "Live", "The first phase. It lasts forever.",
- new Integer(0), null, null);
- pd.save();
-
- lcd.save();
-
- m_lcd = lcd;
-
- m_section.addLifecycleDefinition(lcd);
- m_section.save();
- }
-
- /**
- * SAX Handler for category lists. Creates the categories as they are
- * defined, with structure, in the xml document.
- */
- private class CategoryHandler extends DefaultHandler {
- private Stack m_cats = new Stack();
- private ContentSection m_section;
-
- public CategoryHandler(ContentSection section) {
- m_section = section;
- }
-
- @Override
- public void startElement ( String uri, String local,
- String qName, Attributes attrs ) {
- if ("categories".equals(qName)) {
- String name = attrs.getValue("name");
- if (name == null) {
- name = "Root";
- }
- String description = attrs.getValue("description");
- String context = attrs.getValue("context");
-
- Category root = Category.getRootForObject(m_section,
- context);
- if (root == null) {
- root = new Category();
- }
- root.setName(name);
- root.setDescription(description);
-
- if (root.isNew()) {
- Category.setRootForObject(m_section,
- root,
- context);
- }
- m_cats.push(root);
- PermissionService.setContext(root, m_section);
- } else if ( "category".equals(qName) ) {
- String name = attrs.getValue("name");
- String description = attrs.getValue("description");
- String url = attrs.getValue("url");
-
- // set the default description to the name of the category
- if ( description == null ) {
- description = name;
- }
-
- s_log.debug("creating category '" + name + "'");
- Category cat = new Category(name, description, url);
- cat.save();
-
- Category parent = null;
- try {
- parent = (Category)m_cats.peek();
- } catch ( EmptyStackException ex ) {
- throw new UncheckedWrapperException("no root category", ex);
- }
-
- parent.addChild(cat);
- parent.save();
- cat.setDefaultParentCategory(parent);
- cat.save();
-
- m_cats.push(cat);
- }
- }
-
- @Override
- public void endElement ( String uri, String local, String qName ) {
- if ( "category".equals(qName) ) {
- m_cats.pop();
- } else if ( "categories".equals(qName)) {
- m_cats.pop();
- }
- }
- }
-
- /**
- *
- * @param tasks
- */
- public void loadAlertPrefs(List tasks) {
- if (tasks == null) {
- // fallback to default com.arsdigita.cms.default_task_alerts registry parameter
- String[] defaultTaskAlerts = ContentSection.getConfig().getDefaultTaskAlerts();
- if (defaultTaskAlerts != null) {
- for (int i=0,n=defaultTaskAlerts.length; i
Initializes the Content Management System, including the Content Center - * and CMS Service applications and CMS Mime Types service. This class also - * optionally initializes user-defined content types and user-defined content - * sections.
- * - * - * @author Peter Boy (pboy@barkhof.uni-bremen.de) - * @version $Id: $ - * - */ -public class Initializer extends CompoundInitializer { - - /** Creates a s_logging category with name = to the full name of class */ - private static Logger s_log = Logger.getLogger(Initializer.class); - - private static final LoaderConfig s_conf = new LoaderConfig(); -// Verursacht aktuell eine Exception "no such context" -// Vermutliche Lösung: in config.xml eintragen. -// static { // requirred to actually read the config file! -// s_conf.load(); -// } - - /** - * Constructor - */ - public Initializer() { - //final String url = RuntimeConfig.getConfig().getJDBCURL(); - //final int database = DbHelper.getDatabaseFromURL(url); - - s_log.debug("CMS.installer.Initializer.(Constructor) completed"); - } - -// /** -// * An empty implementation of {@link Initializer#init(DataInitEvent)}. -// * -// * @param evt The data init event. -// */ -// public void init(DataInitEvent evt) { -// } - - /** - * Initializes domain-coupling machinery, usually consisting of - * registering object instantiators and observers. - * - */ - public void init(DomainInitEvent evt) { - s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked"); - - super.init(evt); // ! - - /* - * Imported from LegacyInitializer: - * TASK: - * Check if CMS package type exists. If not, then: - * - *Provides methods to install the Content Management System.
- * - *This class includes methods to:
- * - *Create the CMS package type.
Create the CMS package instance.
Create a default content section.
Mount a CMS package instance (and content section).
Creates the CMS package type.
- * - *This includes creating and registering XSL stylesheets to the CMS . - * package type and registering privileges for use by CMS.
- * - * @return The CMS package type - */ - protected static PackageType createPackageType() - throws DataObjectNotFoundException { - - PackageType type = PackageType.create - (PACKAGE_KEY, "Content Management System", "Content Management Systems", - "http://cms-java.arsdigita.com/"); - type.setDispatcherClass(DISPATCHER_CLASS); - type.addListener(LISTENER_CLASS); - - // Register a stylesheets to the CMS package. - Stylesheet ss = Stylesheet.createStylesheet(STYLESHEET); - ss.save(); - type.addStylesheet(ss); - type.save(); - - createPrivileges(); - - return type; - } - - /** - *Creates the CMS package type.
- * - *This includes creating and registering XSL stylesheets to the CMS . - * package type and registering privileges for use by CMS.
- * - * @param name The name of the package instance - * @return A new CMS package instance - */ - protected static PackageInstance createPackageInstance(String name) - throws DataObjectNotFoundException { - - PackageType type = PackageType.findByKey(PACKAGE_KEY); - PackageInstance instance = type.createInstance(name); - instance.save(); - return instance; - } - - /** - *Mounts a CMS package instance.
- * - *This includes creating and registering XSL stylesheets to the CMS . - * package type and registering privileges for use by CMS.
- * - * @param instance The package instance - * @param location The location of the package instance (and content section) - * @return The SiteNode where the content section is mounted at - */ - protected static SiteNode mountPackageInstance(PackageInstance instance, - String location) { - SiteNode node = - SiteNode.createSiteNode(location, SiteNode.getRootSiteNode()); - node.mountPackage(instance); - node.save(); - - return node; - } - - - - - /** - * Creates and maps default resources to the content section. - * - * @param section The content section - * - * MP: create resource types. - * MP: use the resources API. - * MP: only create resources once. - */ - protected static void createDefaultResources(ContentSection section) { - // XML resources - ResourceType rt = ResourceType.findResourceType("xml"); - Resource r = - rt.createInstance("com.arsdigita.cms.ui.ContentSectionPage"); - r.save(); - ResourceMapping rm = r.createInstance(section, "admin"); - rm.save(); - rm = r.createInstance(section, "admin/index"); - rm.save(); - - //This won't be served by the new application-oriented CMS dispatcher. - //The default folder template creates this instead now. - // r = rt.createInstance("com.arsdigita.cms.user.ItemIndexPage"); - // r.save(); - // rm = r.createInstance(section, "index"); - // rm.save(); - - r = rt.createInstance("com.arsdigita.cms.ui.ContentItemPage"); - r.save(); - rm = r.createInstance(section, "admin/item"); - rm.save(); - } - - /** - * Creates the CMS privileges. - */ - private static void createPrivileges() { - - final String CMS_PRIVILEGES = "com.arsdigita.cms.getPrivileges"; - final String PRIVILEGE = "privilege"; - - DataQuery dq = SessionManager.getSession().retrieveQuery(CMS_PRIVILEGES); - while ( dq.next() ) { - String privilege = (String) dq.get(PRIVILEGE); - if ( PrivilegeDescriptor.get(privilege) == null ) { - PrivilegeDescriptor.createPrivilege(privilege); - } - } - dq.close(); - } - - - - /** - * Creates the root folder for a content section. - * - * @param name The name of the content section - * @return The root folder - */ - protected static Folder createRootFolder(String name) { - Folder root = new Folder(); - root.setName("/"); - root.setLabel( (String) GlobalizationUtil.globalize("cms.installer.root_folder").localize()); - root.save(); - return root; - } - - /** - * Creates the root category for a content section. - * - * @param name The name of the content section - * @return The root category - */ - protected static Category createRootCategory(String name) { - Category root = new Category("/", "Root Category"); - root.save(); - return root; - } - - - - - ////////////////////////////////// - // - // PackageEventListener methods - // - - /** - * This method is called when a package instance is mounted on a - * siteNode. It does nothing. - * - * @param siteNode The SiteNode where the instance is mounted. - * @param pkg The instance being mounted. - */ - public void onMount(SiteNode siteNode, PackageInstance pkg) {} - - /** - * This method is called when a package instance is unmounted from a - * siteNode. It does nothing. - * - * @param siteNode The SiteNode where the instance is mounted. - * @param pkg The instance being unmounted. - */ - public void onUnmount(SiteNode siteNode, PackageInstance pkg) {} - - - /** - * This method is called when a new package instance is created. - * This method creates a content section and a new instance of - * the CMS package. - * - * @param pkg aPackageInstance value
- */
- public void onCreate(PackageInstance pkg) {
- }
-
- /**
- * This method is called when a package instance is deleted.
- * It does nothing.
- *
- * @param pkg a PackageInstance value
- */
- public void onDelete(PackageInstance pkg) {}
-
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/LegacyInitializer.java.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/LegacyInitializer.java.nolongerInUse
deleted file mode 100755
index f5d373721..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/LegacyInitializer.java.nolongerInUse
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.installer;
-
-// unused import com.arsdigita.auditing.BasicAuditTrail;
-import com.arsdigita.cms.LoaderConfig;
-import com.arsdigita.cms.dispatcher.ContentCenterDispatcher;
-import com.arsdigita.cms.dispatcher.ItemDispatcher;
-// unused import com.arsdigita.domain.DomainObject;
-// unused import com.arsdigita.domain.DomainObjectFactory;
-// unused import com.arsdigita.domain.DomainObjectInstantiator;
-import com.arsdigita.initializer.Configuration;
-import com.arsdigita.initializer.InitializationException;
-// unused import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.TransactionContext;
-
-import org.apache.log4j.Logger;
-
-
-
-
-/**
- * The main initializer for the Content Management System.
- * - *Initializes the Content Management System, including the Content Center - * and CMS Service applications and CMS Mime Types service. This class also - * optionally initializes user-defined content types and user-defined content - * sections.
- * - * @author Michael Pih (pihman@arsdigita.com) - * @version $Revision: #47 $ $Date: 2004/08/17 $ - * @since ACS 5.0 - */ -public class LegacyInitializer extends com.arsdigita.kernel.BaseInitializer { - - private static Logger s_log = Logger.getLogger(Initializer.class); - - private final static String CACHE_ITEMS - = "cacheItems"; - private static final String UPDATE_MASTER - = "updateMasterObject"; - private final static String CONTENT_CENTER_MAP - = "contentCenterMap"; - private final static String WORKSPACE - = "workspace"; - // Init script parameters - private Configuration m_conf = new Configuration(); - - // Temporär: Einbinden des neuen Parameter Systems - private static final LoaderConfig s_conf = new LoaderConfig(); -// LoaderConfig conf = LoaderConfig.getConfig(); - -// As an example -// private static final ContentSectionConfig s_config = new ContentSectionConfig(); - -// static { -// s_config.load(); -// } - - - - public LegacyInitializer() throws InitializationException { - m_conf.initParameter - (WORKSPACE, "The name of the workspace package instance", - String.class); - m_conf.initParameter - (CACHE_ITEMS, - "Enable caching of content items", - Boolean.class, - Boolean.TRUE); - m_conf.initParameter - (UPDATE_MASTER, - "If true, attempts to recursively set the correct master object for " + - "all content items within the system.", - Boolean.class, - Boolean.FALSE); - m_conf.initParameter - (CONTENT_CENTER_MAP, - "XML Mapping of the content center tabs to " + - "URLs, see ContentCenterDispatcher", - String.class, - ContentCenterDispatcher.DEFAULT_MAP_FILE); - } - - public Configuration getConfiguration() { - return m_conf; - } - - - /** - * Check if CMS package type exists. If not, then: - * - *Initializes a content section, registering a default - * workflow, lifecycle & roles and adding the content types - * - *
The initialization process takes several configuration
- * parameters. The name is the name of the content
- * section, the types is a list of content types
- * to register
- *
- * XXX As of version 6.5 (pboy):
- * Commented out in cms.enterprise.init since several versions. Not invoked by
- * any other package of trunk. Some Parameters (as ITEM_RESOLVER_CLASS) are
- * configured in ContentSectionConfig.java as a temporary measure.
- *
- * @author Daniel Berrange (berrange@redhat.com)
- * @author Michael Pih
- * @version $Id: SectionLegacyInitializer.java 287 2005-02-22 00:29:02Z sskracic $
- */
-public class SectionLegacyInitializer extends com.arsdigita.kernel.BaseInitializer {
-
- private static org.apache.log4j.Logger s_log =
- org.apache.log4j.Logger.getLogger(SectionLegacyInitializer.class);
-
-// private static final String NAME = "name";
-// private static final String TYPES = "types";
-// private static final String ROLES = "roles";
-// private static final String PUBLIC = "public";
-// private static final String CATEGORIES = "categories";
-// private static final String TASK_ALERTS = "taskAlerts";
-// private static final String SEND_OVERDUE_ALERTS = "sendOverdueAlerts";
-// private static final String TASK_DURATION = "taskDuration";
-// private static final String OVERDUE_ALERT_INTERVAL = "alertInterval";
-// private static final String MAX_ALERTS = "maxAlerts";
-// private static final String ITEM_RESOLVER_CLASS = "itemResolverClass";
-// private static final String TEMPLATE_RESOLVER_CLASS = "templateResolverClass";
-
-// private Configuration m_conf = new Configuration();
-
- // Temporär: Einbinden des neuen Parameter Systems
- private static final LoaderConfig s_conf = new LoaderConfig();
-
- // Required to actually load the parameter file.
- // Aktuell: wenn man das aktiviert, gibt's einen Fehler: Kontext existiert
- // nicht, offensichtlich keine aktuelle Datei zugeordnet.
-// static {
-// s_conf.load();
-// }
-
- // the Timer used to send Unfinished notifications
- private static Timer s_unfinishedTimer;
-
- public SectionLegacyInitializer() throws InitializationException {
- s_log.debug("CMS.installer.SectionLegacyInitializer.(Constructor) invoked");
-// m_conf.initParameter(NAME,
-// "The name of the content section",
-// String.class);
-// m_conf.initParameter(TYPES,
-// "The content types to register",
-// List.class);
-// m_conf.initParameter(ROLES,
-// "The roles to create",
-// List.class);
-// m_conf.initParameter(PUBLIC,
-// "Whether to make published content available to non-registered users",
-// Boolean.class);
-// m_conf.initParameter(CATEGORIES,
-// "XML file containing the category tree",
-// List.class,
-// Collections.EMPTY_LIST);
-// m_conf.initParameter(TASK_ALERTS,
-// "A list of workflow tasks, and the events for which alerts are sent",
-// List.class);
-// m_conf.initParameter(SEND_OVERDUE_ALERTS,
-// "Send alerts when a task is overdue (has remained in the \"enabled\" state for a long time)",
-// Boolean.class,
-// Boolean.FALSE);
- // XXX Once the Duration of a Task can actually be maintained (in the UI, or initialization parameters),
- // we should use the value in the DB, and get rid of this
-// m_conf.initParameter(TASK_DURATION,
-// "How long a task can remain \"enabled\" before it is considered overdue (in hours)",
-// Integer.class);
-// m_conf.initParameter(OVERDUE_ALERT_INTERVAL,
-// "Time to wait between sending overdue notifications on the same task (in hours)",
-// Integer.class);
-// m_conf.initParameter(MAX_ALERTS,
-// "The maximum number of alerts to send that a single task is overdue",
-// Integer.class);
-// m_conf.initParameter(ITEM_RESOLVER_CLASS,
-// "The ItemResolver class to use for the section (defaults to MultilingualItemResolver)",
-// String.class);
-// m_conf.initParameter(TEMPLATE_RESOLVER_CLASS,
-// "The TemplateResolver class to use for the section (defaults to DefaultTemplateResolver)",
-// String.class);
- s_log.debug("CMS.installer.SectionLegacyInitializer.(Constructor) completed");
- }
-
- // required by parent class.
- public Configuration getConfiguration() {
-// return m_conf;
- return null;
- }
-
-
- protected void doStartup() {
- s_log.debug("CMS.installer.SectionLegacyInitializer.doStartup() invoked");
-
- // Create and mount the demo content section if it does not exist.
- // String name = (String) m_conf.getParameter(NAME);
- String name = s_conf.getContentSectionName();
-
- TransactionContext txn =
- SessionManager.getSession().getTransactionContext();
- txn.beginTxn();
-
- // Setup application type content-section first so that concrete
- // content-section can be created.
- ContentSectionSetup.setupContentSectionAppType();
-
- Util.validateURLParameter("name", name);
- String sitemapEntry = "/" + name + "/";
- if (Application.isInstalled(ContentSection.BASE_DATA_OBJECT_TYPE,
- sitemapEntry)) {
- s_log.info("skipping " + name +
- " because it is already installed");
- } else {
- s_log.info("Installing " + name + " at " +
- sitemapEntry);
- createSection(name); // Create a content section, initial
- // creation is a loader task, additional
- // sections may be created during (re)start
- }
-
- ContentSection section = retrieveContentSection(name);
- Assert.exists(section, ContentSection.class);
- ContentSectionSetup setup = new ContentSectionSetup(section);
-
- // setup.loadAlertPrefs((List) m_conf.getParameter(TASK_ALERTS));
- /*
- * loadAlertPrefs loads a list of workflow tasks and associated events
- * from configuration file and fills a hashmap. No database operation.
- * Not a loader task! Moved to contentsection/Initializer
- */
-// Moved from LoaderConfig to contentsection/ContentSectionConfig
-// setup.loadAlertPrefs( s_conf.getTaskAlerts());
-
-// s_unfinishedTimer = setup.startNotifierTask
-// ((Boolean) m_conf.getParameter(SEND_OVERDUE_ALERTS),
-// (Integer) m_conf.getParameter(TASK_DURATION),
-// (Integer) m_conf.getParameter(OVERDUE_ALERT_INTERVAL),
-// (Integer) m_conf.getParameter(MAX_ALERTS));
-
-// Commented out in LoadereConfig because not a Loader task. So commented
-// out here. If SectionLegacyInitializer should ever be used again, a
-// defferent config file (section initializer config) should be used here
- // s_unfinishedTimer = setup.startNotifierTask
- // (s_conf.getSendOverdueAlerts(),
- // s_conf.getTaskDuration(),
- // s_conf.getOverdueAlertInterval(),
- // s_conf.getMaxAlerts());
-
- txn.commitTxn();
- s_log.debug("CMS.installer.SectionLegacyInitializer.doStartup() completed");
- }
-
- /**
- *
- * @param name
- * @return
- */
-
- // seems not to be requirred when using new web application functionality
- // instead of old fashioned PackageType / SiteNode
- // Not migrated to Loader nor to Initializer.
-
- private ContentSection retrieveContentSection(String name) {
- BigDecimal rootNodeID = SiteNode.getRootSiteNode().getID();
- SiteNode node = null;
- try {
- node = SiteNode.getSiteNode("/" + name);
- } catch (DataObjectNotFoundException ex) {
- throw new InitializationException(
- (String) GlobalizationUtil.globalize(
- "cms.installer.root_site_node_missing").localize(), ex);
- }
- ContentSection section = null;
- if ( rootNodeID.equals(node.getID()) ) {
- // This instance does not exist yet.
- section = createSection(name);
- } else {
- try {
- section = ContentSection.getSectionFromNode(node);
- } catch (DataObjectNotFoundException de) {
- throw new InitializationException(
- (String) GlobalizationUtil.globalize(
- "cms.installer.could_not_load_section",
- new Object[] {name}).localize(), de);
- }
- }
- return section;
- }
-
- protected void doShutdown() {
- if (s_unfinishedTimer != null) {
- s_unfinishedTimer.cancel();
- s_unfinishedTimer = null;
- }
- }
-
- /**
- * Install the CMS Demo.
- */
-
- // Moved into Loader
-
- private ContentSection createSection(String name) {
-
- s_log.info("Creating content section on /" + name);
-
-
- ContentSection section = ContentSection.create(name);
-
- ContentSectionSetup setup = new ContentSectionSetup(section);
-
- // Setup the access controls
-
- // section specific categories, usually not used.
- // During initial load at install time nor used at all!
- if (ContentSection.getConfig().getUseSectionCategories()) {
- // Iterator files = ((List) m_conf.getParameter(CATEGORIES)).iterator();
- Iterator files = s_conf.getCategoryFileList().iterator();
- while ( files.hasNext() ) {
- setup.registerCategories((String) files.next());
- }
- }
-
- // setup.registerRoles((List)m_conf.getParameter(ROLES));
- setup.registerRoles(s_conf.getStuffGroup());
- // setup.registerViewers((Boolean)m_conf.getParameter(PUBLIC));
- setup.registerViewers(s_conf.isPubliclyViewable());
- setup.registerAlerts();
- setup.registerPublicationCycles();
- setup.registerWorkflowTemplates();
- // setup.registerContentTypes((List)m_conf.getParameter(TYPES));
- setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
- // setup.registerResolvers
- // ((String) m_conf.getParameter(ITEM_RESOLVER_CLASS),
- // (String) m_conf.getParameter(TEMPLATE_RESOLVER_CLASS));
- setup.registerResolvers
- (s_conf.getItemResolverClass(),
- s_conf.getTemplateResolverClass());
- section.save();
-
- return section;
- }
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/ServiceInstaller.java.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/ServiceInstaller.java.nolongerInUse
deleted file mode 100755
index 95cf1140e..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/ServiceInstaller.java.nolongerInUse
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-// /////////////////////////////////////////////////////////////////////////////
-// Migration Status
-// All tasks this class used to perform are migrated to either cms.Loader or
-// cms.CMS.
-// File is kept in trunk for reference purpose until the whole migration process
-// will be completed. (2010-20-18)
-// /////////////////////////////////////////////////////////////////////////////
-
-
-package com.arsdigita.cms.installer;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.kernel.PackageEventListener;
-import com.arsdigita.kernel.PackageInstance;
-import com.arsdigita.kernel.PackageType;
-import com.arsdigita.kernel.SiteNode;
-
-
-
-/**
- *
Provides methods to install the CMS Service application, which - * is used by the Content Management System as a store for global - * resources and assets.
- * - * @author Michael Pih (pihman@arsdigita.com) - * @version $Revision: #7 $ $DateTime: 2004/08/17 23:15:09 $ - * @version $Id: ServiceInstaller.java 287 2005-02-22 00:29:02Z sskracic $ - */ -public class ServiceInstaller implements PackageEventListener { - - public final static String PACKAGE_KEY = "cms-service"; - - - /** - * Create the CMS services package type. - * @return The package type - */ - protected static PackageType createPackageType() - throws DataObjectNotFoundException { - - PackageType type = PackageType.create - (PACKAGE_KEY, "Content Management System Services", - "Content Management System Services", - "http://cms-service.arsdigita.com/"); - type.setDispatcherClass("com.arsdigita.cms.dispatcher.ServiceDispatcher"); - type.save(); - - return type; - } - - /** - * Create an instance of the CMS service package type. - * @return The package instance - */ - protected static PackageInstance createPackageInstance() - throws DataObjectNotFoundException { - - PackageType type = PackageType.findByKey(PACKAGE_KEY); - PackageInstance instance = type.createInstance(PACKAGE_KEY); - instance.save(); - - return instance; - } - - /** - * Mount the CMS services package instance. - * - * @param instance The package instance - * @param location The URL where the package instance will be mounted - * @return The SiteNode where the instance was mounted - */ - protected static SiteNode mountPackageInstance(PackageInstance instance, - String location) { - SiteNode node = - SiteNode.createSiteNode(location, SiteNode.getRootSiteNode()); - node.mountPackage(instance); - node.save(); - - return node; - } - - - - //////////////////////////////////// - // - // PackageEventListener methods - // - - /** - * This method is called when a package instance is mounted on a - * siteNode. It does nothing. - * - * @param siteNode The SiteNode where the instance is mounted. - * @param pkg The instance being mounted. - */ - public void onMount(SiteNode siteNode, PackageInstance pkg) {} - - /** - * This method is called when a package instance is unmounted from a - * siteNode. It does nothing. - * - * @param siteNode The SiteNode where the instance is mounted. - * @param pkg The instance being unmounted. - */ - public void onUnmount(SiteNode siteNode, PackageInstance pkg) {} - - /** - * This method is called when a new package instance is created. - * It does nothing - * @param pkg aPackageInstance value
- */
- public void onCreate(PackageInstance pkg) {}
-
- /**
- * Describe onDelete method here.
- *
- * @param pkg a PackageInstance value
- */
- public void onDelete(PackageInstance pkg) {}
-
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/VersioningUpgrader.java.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/VersioningUpgrader.java.nolongerInUse
deleted file mode 100755
index d893fbc0a..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/VersioningUpgrader.java.nolongerInUse
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.installer;
-
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.DataQueryDataCollectionAdapter;
-import com.arsdigita.cms.ItemCollection;
-import com.arsdigita.cms.ContentItem;
-
-// From Initializer.java:
-// Update master object if upgrading from old versioning
-// XXX: shouldn't we just gut this section (and
-// VersioningUpgrader)? It is an upgrade fix from 5.1 or
-// earlier, and relying on VersionedACSObject is
-// deprecated
-// (probably written by Michael Pih (pihman@arsdigita.com) )
-
-/**
- * VersioningUpgrader
- *
- * @author Jon Orris
- * @version $Revision: #5 $ $DateTime: 2004/08/17 23:15:09 $
- */
-final class VersioningUpgrader {
-
- private static final String QUERY_TOP_ITEMS =
- "com.arsdigita.cms.topLevelItems";
- private static final String QUERY_ITEM = "item";
-
- /**
- * Update the master object for all the content items, by assuming
- * that all items whose parent is a folder are master objects.
- */
- static void updateMasterObject() {
- DataQuery dq = SessionManager.getSession().retrieveQuery(QUERY_TOP_ITEMS);
- ItemCollection c = new ItemCollection
- (new DataQueryDataCollectionAdapter(dq, QUERY_ITEM));
-
- try {
- while (c.next()) {
- ContentItem item = c.getContentItem();
- item.autoPropagateMaster(item);
- }
- } finally {
- c.close();
- }
- }
-
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/WorkspaceInstaller.java.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/WorkspaceInstaller.java.nolongerInUse
deleted file mode 100755
index b62bf5191..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/WorkspaceInstaller.java.nolongerInUse
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-
-// /////////////////////////////////////////////////////////////////////////////
-// Migration Status
-// All tasks this class used to perform are migrated to either cms.Loader or
-// cms.CMS.
-// File is kept in trunk for reference purpose until the whole migration process
-// will be completed. (2010-20-18)
-// /////////////////////////////////////////////////////////////////////////////
-
-
-package com.arsdigita.cms.installer;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.kernel.PackageEventListener;
-import com.arsdigita.kernel.PackageInstance;
-import com.arsdigita.kernel.PackageType;
-import com.arsdigita.kernel.SiteNode;
-import com.arsdigita.kernel.Stylesheet;
-
-
-/**
- * Provides methods to install the Content Center application, which - * is used by the Content Management System.
- * - * @author Michael Pih (pihman@arsdigita.com) - * @author Jack Chung (flattop@arsdigita.com) - * @version $Revision: #10 $ $DateTime: 2004/08/17 23:15:09 $ - * @version $Id: WorkspaceInstaller.java 287 2005-02-22 00:29:02Z sskracic $ - */ -public class WorkspaceInstaller implements PackageEventListener { - - public static final String PACKAGE_KEY = "content-center"; - private static final String INSTANCE_NAME = "Content Center"; - private static final String DISPATCHER_CLASS = - "com.arsdigita.cms.dispatcher.ContentCenterDispatcher"; - - // To be updated soon... - // "com.arsdigita.dispatcher.DefaultPackageDispatcher"; - - /** - * Returns this workspace's instance name - **/ - public String getPackageKey() { - return PACKAGE_KEY; - } - - /** - * Returns this workspace's instance name - **/ - public String getInstanceName() { - return INSTANCE_NAME; - } - - /** - * Returns the name of the dispatcher class to use - **/ - protected String getDispatcherClass() { - return DISPATCHER_CLASS; - } - - /** - * Create the CMS package type. - * - * @return The Content Center package type - */ -// protected PackageType createPackageType() - public PackageType createPackageType() - throws DataObjectNotFoundException { - - PackageType type = PackageType.create - (getPackageKey(), "Content Center", - "Content Centers", - "http://cms-workspace.arsdigita.com/"); - type.setDispatcherClass(getDispatcherClass()); - - // Register a stylesheet to the Content Center package. - Stylesheet ss = - Stylesheet.createStylesheet( - "/packages/content-section/xsl/content-center.xsl"); - ss.save(); - type.addStylesheet(ss); - - type.save(); - - return type; - } - - /** - * Create the Content Center application instance. - * - * @return The Content Center package instance - */ -// protected PackageInstance createPackageInstance() - public PackageInstance createPackageInstance() - throws DataObjectNotFoundException { - - PackageType type = - PackageType.findByKey(getPackageKey()); - PackageInstance instance = - type.createInstance(getInstanceName()); - instance.save(); - - return instance; - } - - /** - * Mount the Content Center application instance. - * - * @param instance The package instance - * @param location The location of the Content Center - * @return The SiteNode where the Content Center is mounted at - */ -// protected SiteNode mountPackageInstance(PackageInstance instance, - public SiteNode mountPackageInstance(PackageInstance instance, - String location) { - SiteNode node = - SiteNode.createSiteNode(location, SiteNode.getRootSiteNode()); - node.mountPackage(instance); - node.save(); - - return node; - } - - ///////////////////////////////////// - // - // PackageEventListener methods - // - - /** - * This method is called when a package instance is mounted on a - * siteNode. It does nothing. - * - * @param siteNode The SiteNode where the instance is mounted. - * @param pkg The instance being mounted. - */ - public void onMount(SiteNode siteNode, PackageInstance pkg) {} - - /** - * This method is called when a package instance is unmounted from a - * siteNode. It does nothing. - * - * @param siteNode The SiteNode where the instance is mounted. - * @param pkg The instance being unmounted. - */ - public void onUnmount(SiteNode siteNode, PackageInstance pkg) {} - - - /** - * This method is called when a new package instance is created. - * It does nothing - * @param pkg aPackageInstance value
- */
- public void onCreate(PackageInstance pkg) {}
-
- /**
- * Describe onDelete method here.
- *
- * @param pkg a PackageInstance value
- */
- public void onDelete(PackageInstance pkg) {}
-
-
-}
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/enterprise.init.nolongerInUse b/ccm-cms/src/com/arsdigita/cms/installer/enterprise.init.nolongerInUse
deleted file mode 100644
index bd88869e7..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/enterprise.init.nolongerInUse
+++ /dev/null
@@ -1,15 +0,0 @@
-// CMS initialization file
-//
-// $Id: enterprise.init 2070 2010-01-28 08:47:41Z pboy $
-//
-
-// Migration status: Config parameters in cms/LoaderConfig (these options are to
-// be used only once during installation).
-// Config options in Initializer replaced by the new Config.
-init com.arsdigita.cms.installer.LegacyInitializer {
- updateMasterObject = false;
- workspace = "content-center";
- contentCenterMap = "/WEB-INF/resources/content-center-map.xml";
-}
-
-
diff --git a/ccm-cms/src/com/arsdigita/cms/installer/package.html b/ccm-cms/src/com/arsdigita/cms/installer/package.html
deleted file mode 100755
index 5e82fe5d3..000000000
--- a/ccm-cms/src/com/arsdigita/cms/installer/package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Provides a set of classes to install and initialize the Content - Management System.
- -There are two common types of files:
- -Installers - These classes contain the code to - install the Content Management System and mount content - sections.
Initializers - These classes are run at server - startup and are used to install the Content Management System if - it has not already been installed. For the most part, - initializers call the installers' methods.
- * <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> - *- * - * Initializer - *
- * init com.arsdigita.cms.installer.ContentTypeInitializer {
- * contentTypes = {
- * "/WEB-INF/content-types/Article.xml"
- * };
- * }
- *
- * @author Nobuko Asakai