Anlegen einer neuen content section per Configuration file funktioniert jetzt.
git-svn-id: https://svn.libreccm.org/ccm/trunk@768 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5083e1cbbf
commit
ed616f18d5
|
|
@ -4,10 +4,10 @@
|
||||||
storage="ccm-cms/cms.properties"/>
|
storage="ccm-cms/cms.properties"/>
|
||||||
<config class="com.arsdigita.cms.contentsection.ContentSectionConfig"
|
<config class="com.arsdigita.cms.contentsection.ContentSectionConfig"
|
||||||
storage="ccm-cms/contentsection.properties"/>
|
storage="ccm-cms/contentsection.properties"/>
|
||||||
<config class="com.arsdigita.cms.LoaderConfig"
|
|
||||||
storage="ccm-cms/loader.properties"/>
|
|
||||||
<config class="com.arsdigita.cms.lifecycle.LifecycleConfig"
|
<config class="com.arsdigita.cms.lifecycle.LifecycleConfig"
|
||||||
storage="ccm-cms/lifecycle.properties"/>
|
storage="ccm-cms/lifecycle.properties"/>
|
||||||
|
<config class="com.arsdigita.cms.LoaderConfig"
|
||||||
|
storage="ccm-cms/loader.properties"/>
|
||||||
<config class="com.arsdigita.cms.publishToFile.PublishToFileConfig"
|
<config class="com.arsdigita.cms.publishToFile.PublishToFileConfig"
|
||||||
storage="ccm-cms/publishToFile.properties"/>
|
storage="ccm-cms/publishToFile.properties"/>
|
||||||
<config class="com.arsdigita.cms.contenttypes.GenericAddressConfig"
|
<config class="com.arsdigita.cms.contenttypes.GenericAddressConfig"
|
||||||
|
|
|
||||||
|
|
@ -1159,7 +1159,9 @@ public class ContentSection extends Application {
|
||||||
templates.save();
|
templates.save();
|
||||||
|
|
||||||
//create and initialize the content section application
|
//create and initialize the content section application
|
||||||
ContentSection section = (ContentSection) Application.createApplication(BASE_DATA_OBJECT_TYPE, name, name, null);
|
ContentSection section = (ContentSection) Application
|
||||||
|
.createApplication(BASE_DATA_OBJECT_TYPE
|
||||||
|
, name, name, null);
|
||||||
section.initialize(name,
|
section.initialize(name,
|
||||||
folder,
|
folder,
|
||||||
category,
|
category,
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ import com.arsdigita.cms.dispatcher.AssetURLFinder;
|
||||||
import com.arsdigita.cms.dispatcher.ItemDelegatedURLPatternGenerator;
|
import com.arsdigita.cms.dispatcher.ItemDelegatedURLPatternGenerator;
|
||||||
import com.arsdigita.cms.dispatcher.ItemTemplatePatternGenerator;
|
import com.arsdigita.cms.dispatcher.ItemTemplatePatternGenerator;
|
||||||
import com.arsdigita.cms.dispatcher.ItemURLFinder;
|
import com.arsdigita.cms.dispatcher.ItemURLFinder;
|
||||||
// import com.arsdigita.cms.installer.WorkspaceInstaller;
|
|
||||||
// import com.arsdigita.cms.installer.ContentCenterSetup;
|
|
||||||
import com.arsdigita.cms.publishToFile.PublishToFileListener;
|
import com.arsdigita.cms.publishToFile.PublishToFileListener;
|
||||||
import com.arsdigita.cms.publishToFile.QueueManager;
|
import com.arsdigita.cms.publishToFile.QueueManager;
|
||||||
import com.arsdigita.cms.search.AssetMetadataProvider;
|
import com.arsdigita.cms.search.AssetMetadataProvider;
|
||||||
|
|
@ -50,10 +48,6 @@ import com.arsdigita.domain.DomainObjectInstantiator;
|
||||||
import com.arsdigita.domain.xml.TraversalHandler;
|
import com.arsdigita.domain.xml.TraversalHandler;
|
||||||
import com.arsdigita.kernel.ACSObjectInstantiator;
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
import com.arsdigita.kernel.NoValidURLException;
|
import com.arsdigita.kernel.NoValidURLException;
|
||||||
// import com.arsdigita.kernel.PackageInstance;
|
|
||||||
// import com.arsdigita.kernel.PackageInstanceCollection;
|
|
||||||
// import com.arsdigita.kernel.PackageType;
|
|
||||||
// import com.arsdigita.kernel.SiteNode;
|
|
||||||
import com.arsdigita.kernel.URLFinder;
|
import com.arsdigita.kernel.URLFinder;
|
||||||
import com.arsdigita.kernel.URLFinderNotFoundException;
|
import com.arsdigita.kernel.URLFinderNotFoundException;
|
||||||
import com.arsdigita.kernel.URLService;
|
import com.arsdigita.kernel.URLService;
|
||||||
|
|
@ -65,7 +59,6 @@ import com.arsdigita.persistence.pdl.NameFilter;
|
||||||
import com.arsdigita.runtime.CompoundInitializer;
|
import com.arsdigita.runtime.CompoundInitializer;
|
||||||
// import com.arsdigita.runtime.ConfigError;
|
// import com.arsdigita.runtime.ConfigError;
|
||||||
import com.arsdigita.runtime.DomainInitEvent;
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
import com.arsdigita.runtime.LegacyInitializer;
|
|
||||||
import com.arsdigita.runtime.PDLInitializer;
|
import com.arsdigita.runtime.PDLInitializer;
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
import com.arsdigita.runtime.RuntimeConfig;
|
||||||
import com.arsdigita.search.FilterType;
|
import com.arsdigita.search.FilterType;
|
||||||
|
|
@ -101,17 +94,11 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class Initializer extends CompoundInitializer {
|
public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
|
|
||||||
/** Creates a s_logging category with name = to the full name of class */
|
/** Creates a s_logging category with name = to the full name of class */
|
||||||
private static Logger s_log = Logger.getLogger(Initializer.class);
|
private static Logger s_log = Logger.getLogger(Initializer.class);
|
||||||
|
|
||||||
/** Configuration object for the CMS module */
|
/** Configuration object for the CMS module */
|
||||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
||||||
// 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, adds db connection information and various sub-initializers
|
* Constructor, adds db connection information and various sub-initializers
|
||||||
|
|
@ -303,6 +290,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
f.registerInstantiator
|
f.registerInstantiator
|
||||||
(CMSTask.BASE_DATA_OBJECT_TYPE,
|
(CMSTask.BASE_DATA_OBJECT_TYPE,
|
||||||
new ACSObjectInstantiator() {
|
new ACSObjectInstantiator() {
|
||||||
|
@Override
|
||||||
public DomainObject doNewInstance(DataObject dataObject) {
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new CMSTask(dataObject);
|
return new CMSTask(dataObject);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,6 @@ public class Loader extends PackageLoader {
|
||||||
appsetup.setSingleton(true);
|
appsetup.setSingleton(true);
|
||||||
appsetup.setPortalApplication(false);
|
appsetup.setPortalApplication(false);
|
||||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new Workspace(dataObject);
|
return new Workspace(dataObject);
|
||||||
|
|
@ -434,7 +433,6 @@ public class Loader extends PackageLoader {
|
||||||
appsetup.setSingleton(true);
|
appsetup.setSingleton(true);
|
||||||
appsetup.setPortalApplication(false);
|
appsetup.setPortalApplication(false);
|
||||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new Service(dataObject);
|
return new Service(dataObject);
|
||||||
|
|
@ -481,13 +479,17 @@ public class Loader extends PackageLoader {
|
||||||
appType.setPortalApplication(false);
|
appType.setPortalApplication(false);
|
||||||
//setup.setDispatcherClass(ContentItemDispatcher.class.getName());
|
//setup.setDispatcherClass(ContentItemDispatcher.class.getName());
|
||||||
// contains the xsl to generate the page
|
// contains the xsl to generate the page
|
||||||
appType.setInstantiator(new ACSObjectInstantiator() {
|
|
||||||
|
|
||||||
|
// ApplicationSetup requires an Instantiator which has to be set here
|
||||||
|
// Setting it up in Initializer prior to creating the application type
|
||||||
|
// doesn't work!
|
||||||
|
appType.setInstantiator(new ACSObjectInstantiator() {
|
||||||
@Override
|
@Override
|
||||||
public DomainObject doNewInstance(DataObject dataObject) {
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new ContentSection(dataObject);
|
return new ContentSection(dataObject);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appType.run();
|
appType.run();
|
||||||
|
|
||||||
// Step 3:
|
// Step 3:
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import org.apache.log4j.Logger;
|
||||||
* later after the installation step.
|
* later after the installation step.
|
||||||
*
|
*
|
||||||
* @author pb
|
* @author pb
|
||||||
|
* @version $Id: LoaderConfig.java $
|
||||||
*/
|
*/
|
||||||
public final class LoaderConfig extends AbstractConfig {
|
public final class LoaderConfig extends AbstractConfig {
|
||||||
|
|
||||||
|
|
@ -111,8 +112,8 @@ public final class LoaderConfig extends AbstractConfig {
|
||||||
* An entry in this list is required by internal content types (see package
|
* An entry in this list is required by internal content types (see package
|
||||||
* ccm-cms/src/com/arsdigita/cms/contenttypes)
|
* ccm-cms/src/com/arsdigita/cms/contenttypes)
|
||||||
*/
|
*/
|
||||||
private final Parameter
|
private final Parameter m_ctDefFiles =
|
||||||
m_ctDefFiles = new StringArrayParameter(
|
new StringArrayParameter(
|
||||||
"com.arsdigita.cms.loader.contenttype_definition_files",
|
"com.arsdigita.cms.loader.contenttype_definition_files",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
// Generic*.xml added by Quasi in enterprise.init for
|
// Generic*.xml added by Quasi in enterprise.init for
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,9 @@ public final class ContentSectionConfig extends AbstractConfig {
|
||||||
* See contentsection.ContentSectionSetup.registerRoles()
|
* See contentsection.ContentSectionSetup.registerRoles()
|
||||||
* In enterprise.init: name roles, List of roles to create.
|
* In enterprise.init: name roles, List of roles to create.
|
||||||
*
|
*
|
||||||
* Not implemented yet! We need a new parameter type "list" which must have
|
* ** Not implemented yet! **
|
||||||
* multidimensional capabilities.
|
* We need a new parameter type "list" which must have multidimensional
|
||||||
|
* capabilities.
|
||||||
*/
|
*/
|
||||||
// private final StringParameter
|
// private final StringParameter
|
||||||
// m_staffGroup = new StringParameter(
|
// m_staffGroup = new StringParameter(
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,8 @@ public final class ContentSectionSetup {
|
||||||
* Wrapper class to create and configure a content section instance
|
* Wrapper class to create and configure a content section instance
|
||||||
* in one step.
|
* in one step.
|
||||||
*
|
*
|
||||||
|
* Method needs a transaction to proceed successfully.
|
||||||
|
* {@link com.arsdigita.cms.contentsection.Initializer#checkForNewContentSection() }
|
||||||
*/
|
*/
|
||||||
public static void setupContentSectionAppInstance(String name,
|
public static void setupContentSectionAppInstance(String name,
|
||||||
List staffGroup,
|
List staffGroup,
|
||||||
|
|
@ -265,21 +267,25 @@ public final class ContentSectionSetup {
|
||||||
public void registerResolvers(String itemResolverClassName,
|
public void registerResolvers(String itemResolverClassName,
|
||||||
String templateResolverClassName) {
|
String templateResolverClassName) {
|
||||||
|
|
||||||
if (itemResolverClassName != null && itemResolverClassName.length() > 0) {
|
if (itemResolverClassName != null
|
||||||
|
&& itemResolverClassName.length() > 0) {
|
||||||
m_section.setItemResolverClass(itemResolverClassName);
|
m_section.setItemResolverClass(itemResolverClassName);
|
||||||
s_log.info("Registering " + itemResolverClassName
|
s_log.info("Registering " + itemResolverClassName
|
||||||
+ " as the item resolver class");
|
+ " as the item resolver class");
|
||||||
} else {
|
} else {
|
||||||
m_section.setItemResolverClass(ContentSection.getConfig().getDefaultItemResolverClass().getName());
|
m_section.setItemResolverClass(ContentSection.getConfig()
|
||||||
|
.getDefaultItemResolverClass().getName());
|
||||||
s_log.info("Registering " + itemResolverClassName
|
s_log.info("Registering " + itemResolverClassName
|
||||||
+ " as the item resolver class");
|
+ " as the item resolver class");
|
||||||
}
|
}
|
||||||
if (templateResolverClassName != null && templateResolverClassName.length() > 0) {
|
if (templateResolverClassName != null
|
||||||
|
&& templateResolverClassName.length() > 0) {
|
||||||
m_section.setTemplateResolverClass(templateResolverClassName);
|
m_section.setTemplateResolverClass(templateResolverClassName);
|
||||||
s_log.info("Registering " + templateResolverClassName
|
s_log.info("Registering " + templateResolverClassName
|
||||||
+ " as the template resolver class");
|
+ " as the template resolver class");
|
||||||
} else {
|
} else {
|
||||||
m_section.setTemplateResolverClass(ContentSection.getConfig().getDefaultTemplateResolverClass().getName());
|
m_section.setTemplateResolverClass(ContentSection.getConfig()
|
||||||
|
.getDefaultTemplateResolverClass().getName());
|
||||||
s_log.info("Registering " + templateResolverClassName
|
s_log.info("Registering " + templateResolverClassName
|
||||||
+ " as the template resolver class");
|
+ " as the template resolver class");
|
||||||
}
|
}
|
||||||
|
|
@ -474,7 +480,8 @@ public final class ContentSectionSetup {
|
||||||
final InputStream stream = loader.getResourceAsStream(filename.substring(1));
|
final InputStream stream = loader.getResourceAsStream(filename.substring(1));
|
||||||
|
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
throw new IllegalStateException((String) GlobalizationUtil.globalize("cms.installer.cannot_find_file").localize() + filename);
|
throw new IllegalStateException((String) GlobalizationUtil.globalize(
|
||||||
|
"cms.installer.cannot_find_file").localize() + filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
final BufferedReader input = new BufferedReader(new InputStreamReader(stream));
|
final BufferedReader input = new BufferedReader(new InputStreamReader(stream));
|
||||||
|
|
@ -501,7 +508,8 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
temp.save();
|
temp.save();
|
||||||
|
|
||||||
TemplateManagerFactory.getInstance().addTemplate(m_section, type, temp, "public");
|
TemplateManagerFactory.getInstance()
|
||||||
|
.addTemplate(m_section, type, temp, "public");
|
||||||
|
|
||||||
temp.publish(m_lcd, new Date());
|
temp.publish(m_lcd, new Date());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,24 +22,20 @@ package com.arsdigita.cms.contentsection;
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ContentSectionCollection;
|
import com.arsdigita.cms.ContentSectionCollection;
|
||||||
// import com.arsdigita.cms.LoaderConfig;
|
|
||||||
//import com.arsdigita.cms.installer.Util;
|
|
||||||
// import com.arsdigita.cms.util.GlobalizationUtil;
|
|
||||||
import com.arsdigita.cms.workflow.UnfinishedTaskNotifier;
|
import com.arsdigita.cms.workflow.UnfinishedTaskNotifier;
|
||||||
// import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
// import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.TransactionContext;
|
||||||
// import com.arsdigita.persistence.TransactionContext;
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.runtime.CompoundInitializer;
|
import com.arsdigita.runtime.CompoundInitializer;
|
||||||
// import com.arsdigita.runtime.ConfigError;
|
|
||||||
import com.arsdigita.runtime.ContextInitEvent;
|
import com.arsdigita.runtime.ContextInitEvent;
|
||||||
import com.arsdigita.runtime.ContextCloseEvent;
|
import com.arsdigita.runtime.ContextCloseEvent;
|
||||||
// import com.arsdigita.runtime.DataInitEvent;
|
// import com.arsdigita.runtime.DataInitEvent;
|
||||||
import com.arsdigita.runtime.DomainInitEvent;
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
// import com.arsdigita.util.Assert;
|
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
import com.arsdigita.cms.workflow.CMSTask;
|
import com.arsdigita.cms.workflow.CMSTask;
|
||||||
|
|
||||||
// import java.math.BigDecimal;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
@ -75,7 +71,8 @@ public class Initializer extends CompoundInitializer {
|
||||||
|
|
||||||
/** Local configuration object ContentSectionConfig containing parameters
|
/** Local configuration object ContentSectionConfig containing parameters
|
||||||
which may be changed each system startup. */
|
which may be changed each system startup. */
|
||||||
private static final ContentSectionConfig s_conf = ContentSectionConfig.getInstance();
|
private static final ContentSectionConfig s_conf = ContentSectionConfig
|
||||||
|
.getInstance();
|
||||||
|
|
||||||
/** The Timer used to send Unfinished notifications */
|
/** The Timer used to send Unfinished notifications */
|
||||||
private static Vector s_unfinishedTimers = new Vector();
|
private static Vector s_unfinishedTimers = new Vector();
|
||||||
|
|
@ -95,12 +92,12 @@ public class Initializer extends CompoundInitializer {
|
||||||
// public void init(DataInitEvent evt) {
|
// public void init(DataInitEvent evt) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Currently nothing to do here. Will be changed in the ongoing migration process
|
|
||||||
/**
|
/**
|
||||||
* Initializes domain-coupling machinery, usually consisting of
|
* Initializes domain-coupling machinery, usually consisting of
|
||||||
* registering object instantiators and observers.
|
* registering object instantiators and observers.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(DomainInitEvent evt) {
|
public void init(DomainInitEvent evt) {
|
||||||
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked");
|
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) invoked");
|
||||||
|
|
||||||
|
|
@ -108,37 +105,19 @@ public class Initializer extends CompoundInitializer {
|
||||||
// An empty implementations prevents this initializer from being executed.
|
// An empty implementations prevents this initializer from being executed.
|
||||||
super.init(evt);
|
super.init(evt);
|
||||||
|
|
||||||
// Check here weather a new content section has to be created.
|
/* Register object instantiator for ContentSection */
|
||||||
String newSectionName = s_conf.getNewContentSectionName();
|
evt.getFactory().registerInstantiator
|
||||||
if (newSectionName != null && !newSectionName.isEmpty() ) {
|
(ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||||
ContentSectionCollection sections=ContentSection.getAllSections();
|
new ACSObjectInstantiator() {
|
||||||
sections.addEqualsFilter( Application.PRIMARY_URL,
|
@Override
|
||||||
"/" + newSectionName + "/" );
|
public DomainObject doNewInstance(DataObject dobj) {
|
||||||
ContentSection section;
|
return new ContentSection(dobj);
|
||||||
if( sections.next() ) {
|
|
||||||
// Section with the configured name already exists
|
|
||||||
s_log.debug( "Content section " + newSectionName +
|
|
||||||
" already exists, skipping creation task." );
|
|
||||||
section = sections.getContentSection();
|
|
||||||
sections.close();
|
|
||||||
} else {
|
|
||||||
s_log.debug( "Content section " + newSectionName + " in " +
|
|
||||||
" doesn't exist, creating it." );
|
|
||||||
ContentSectionSetup.setupContentSectionAppInstance
|
|
||||||
(newSectionName,
|
|
||||||
s_conf.getStuffGroup(),
|
|
||||||
s_conf.isPubliclyViewable(),
|
|
||||||
s_conf.getItemResolverClass(),
|
|
||||||
s_conf.getTemplateResolverClass(),
|
|
||||||
s_conf.getContentSectionsContentTypes(),
|
|
||||||
s_conf.getUseSectionCategories(),
|
|
||||||
s_conf.getCategoryFileList()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
// whether we have to create an additional (new) content section
|
||||||
|
// specified in config file.
|
||||||
|
checkForNewContentSection();
|
||||||
|
|
||||||
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) completed");
|
s_log.debug("CMS.installer.Initializer.init(DomainInitEvent) completed");
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +134,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
* A delay value of 0 inhibits start of processing.
|
* A delay value of 0 inhibits start of processing.
|
||||||
* @param evt The context init event.
|
* @param evt The context init event.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(ContextInitEvent evt) {
|
public void init(ContextInitEvent evt) {
|
||||||
s_log.debug("content section ContextInitEvent started");
|
s_log.debug("content section ContextInitEvent started");
|
||||||
|
|
||||||
|
|
@ -185,6 +165,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
s_unfinishedTimers.addElement(unfinishedTimer);
|
s_unfinishedTimers.addElement(unfinishedTimer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sections.close();
|
||||||
|
|
||||||
s_log.debug("content section ContextInitEvent completed");
|
s_log.debug("content section ContextInitEvent completed");
|
||||||
}
|
}
|
||||||
|
|
@ -193,6 +174,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
* Implementation of the {@link Initializer#init(ContextCloseEvent)}
|
* Implementation of the {@link Initializer#init(ContextCloseEvent)}
|
||||||
* method.
|
* method.
|
||||||
*
|
*
|
||||||
|
* Stops various background threads started during startup process.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close(ContextCloseEvent evt) {
|
public void close(ContextCloseEvent evt) {
|
||||||
|
|
@ -211,6 +193,43 @@ public class Initializer extends CompoundInitializer {
|
||||||
s_log.debug("content section ContextCloseEvent completed");
|
s_log.debug("content section ContextCloseEvent completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkForNewContentSection() {
|
||||||
|
|
||||||
|
// Check here weather a new content section has to be created.
|
||||||
|
String newSectionName = s_conf.getNewContentSectionName();
|
||||||
|
if (newSectionName != null && !newSectionName.isEmpty() ) {
|
||||||
|
ContentSectionCollection sections=ContentSection.getAllSections();
|
||||||
|
sections.addEqualsFilter( Application.PRIMARY_URL,
|
||||||
|
"/" + newSectionName + "/" );
|
||||||
|
ContentSection section;
|
||||||
|
if( sections.next() ) {
|
||||||
|
// Section with the configured name already exists
|
||||||
|
s_log.warn( "Content section " + newSectionName +
|
||||||
|
" already exists, skipping creation task.\n" +
|
||||||
|
"You may delete the entry from configuration file.");
|
||||||
|
section = sections.getContentSection();
|
||||||
|
sections.close();
|
||||||
|
} else {
|
||||||
|
s_log.info( "Content section " + newSectionName + " in " +
|
||||||
|
" doesn't exist, creating it." );
|
||||||
|
TransactionContext txn = SessionManager.getSession()
|
||||||
|
.getTransactionContext();
|
||||||
|
txn.beginTxn();
|
||||||
|
ContentSectionSetup.setupContentSectionAppInstance
|
||||||
|
(newSectionName,
|
||||||
|
s_conf.getStuffGroup(),
|
||||||
|
s_conf.isPubliclyViewable(),
|
||||||
|
s_conf.getItemResolverClass(),
|
||||||
|
s_conf.getTemplateResolverClass(),
|
||||||
|
s_conf.getContentSectionsContentTypes(),
|
||||||
|
s_conf.getUseSectionCategories(),
|
||||||
|
s_conf.getCategoryFileList()
|
||||||
|
);
|
||||||
|
txn.commitTxn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps through a string array of tasks and associated alert events
|
* Steps through a string array of tasks and associated alert events
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,13 @@ import org.apache.log4j.Logger;
|
||||||
* @author Oumi Mehrotra
|
* @author Oumi Mehrotra
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @version $Id: DomainObjectFactory.java 738 2005-09-01 12:36:52Z sskracic $
|
* @version $Id: DomainObjectFactory.java 738 2005-09-01 12:36:52Z sskracic $
|
||||||
*
|
|
||||||
**/
|
**/
|
||||||
public class DomainObjectFactory {
|
public class DomainObjectFactory {
|
||||||
|
|
||||||
// map of registered instantiators, keyed by data object type.
|
/** map of registered instantiators, keyed by data object type. */
|
||||||
private static Map s_instantiators = new HashMap();
|
private static Map s_instantiators = new HashMap();
|
||||||
|
|
||||||
|
/** private logger instance. */
|
||||||
private static final Logger s_log = Logger.getLogger(DomainObjectFactory.class);
|
private static final Logger s_log = Logger.getLogger(DomainObjectFactory.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -261,7 +261,8 @@ public class DomainObjectFactory {
|
||||||
*
|
*
|
||||||
* @see #registerInstantiator(ObjectType, DomainObjectInstantiator)
|
* @see #registerInstantiator(ObjectType, DomainObjectInstantiator)
|
||||||
*/
|
*/
|
||||||
public static DomainObjectInstantiator registerInstantiator(String dataObjectType,
|
public static DomainObjectInstantiator registerInstantiator(
|
||||||
|
String dataObjectType,
|
||||||
DomainObjectInstantiator instantiator) {
|
DomainObjectInstantiator instantiator) {
|
||||||
MetadataRoot meta = SessionManager.getMetadataRoot();
|
MetadataRoot meta = SessionManager.getMetadataRoot();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ public class FormbuilderSetup {
|
||||||
throws ConfigError {
|
throws ConfigError {
|
||||||
|
|
||||||
// If the objects list is not null, load the object list into the database
|
// If the objects list is not null, load the object list into the database
|
||||||
// pboy: Obviously, this is a Loader task.
|
|
||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
|
|
||||||
// XXX we don't yet delete types which are no longer in the list
|
// XXX we don't yet delete types which are no longer in the list
|
||||||
|
|
|
||||||
|
|
@ -81,19 +81,18 @@ import com.arsdigita.domain.DomainObject ;
|
||||||
* on the <code>FooGroup</code> instantiator, which contains a hardcoded call
|
* on the <code>FooGroup</code> instantiator, which contains a hardcoded call
|
||||||
* to the constructor for <code>FooGroup</code>.
|
* to the constructor for <code>FooGroup</code>.
|
||||||
*
|
*
|
||||||
* @author Oumi Mehrotra
|
|
||||||
* @version 1.0
|
|
||||||
*
|
|
||||||
* @see com.arsdigita.domain.DomainObjectInstantiator
|
* @see com.arsdigita.domain.DomainObjectInstantiator
|
||||||
* @see com.arsdigita.domain.DomainObjectFactory
|
* @see com.arsdigita.domain.DomainObjectFactory
|
||||||
* @see com.arsdigita.domain.DomainObject
|
* @see com.arsdigita.domain.DomainObject
|
||||||
* @see com.arsdigita.persistence.DataObject
|
* @see com.arsdigita.persistence.DataObject
|
||||||
* @see com.arsdigita.kernel.ACSObject
|
* @see com.arsdigita.kernel.ACSObject
|
||||||
|
*
|
||||||
|
* @author Oumi Mehrotra
|
||||||
|
* @version 1.0
|
||||||
|
* @version $Id: ACSObjectInstantiator.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
**/
|
**/
|
||||||
public class ACSObjectInstantiator extends DomainObjectInstantiator {
|
public class ACSObjectInstantiator extends DomainObjectInstantiator {
|
||||||
|
|
||||||
public static final String versionId = "$Id: ACSObjectInstantiator.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
|
||||||
|
|
||||||
protected boolean m_useReflectionForSubtypes = true;
|
protected boolean m_useReflectionForSubtypes = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ public class Application extends Resource {
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.web.Application";
|
"com.arsdigita.web.Application";
|
||||||
|
|
||||||
|
@Override
|
||||||
protected String getBaseDataObjectType() {
|
protected String getBaseDataObjectType() {
|
||||||
return BASE_DATA_OBJECT_TYPE;
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
@ -171,9 +172,11 @@ public class Application extends Resource {
|
||||||
final ApplicationType type =
|
final ApplicationType type =
|
||||||
ApplicationType.retrieveApplicationTypeForApplication(typeName);
|
ApplicationType.retrieveApplicationTypeForApplication(typeName);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new IllegalArgumentException("No ApplicationType found for type name " + typeName);
|
throw new IllegalArgumentException(
|
||||||
|
"No ApplicationType found for type name " + typeName);
|
||||||
}
|
}
|
||||||
return Application.createApplication(type,fragment,title,parent,createContainerGroup);
|
return Application.createApplication(type,fragment,
|
||||||
|
title,parent,createContainerGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -220,7 +223,8 @@ public class Application extends Resource {
|
||||||
final String title,
|
final String title,
|
||||||
final Application parent,
|
final Application parent,
|
||||||
final boolean createContainerGroup) {
|
final boolean createContainerGroup) {
|
||||||
final Application application = (Application) Resource.createResource(type, title, parent);
|
final Application application = (Application) Resource.createResource(
|
||||||
|
type, title, parent);
|
||||||
if (createContainerGroup) {
|
if (createContainerGroup) {
|
||||||
s_log.debug("Creating Group for application");
|
s_log.debug("Creating Group for application");
|
||||||
application.createGroup();
|
application.createGroup();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue