diff --git a/ccm-core/src/ccm-core.config b/ccm-core/src/ccm-core.config
index f3e89a30d..0b0b27525 100755
--- a/ccm-core/src/ccm-core.config
+++ b/ccm-core/src/ccm-core.config
@@ -1,41 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-core/src/com/arsdigita/core/Initializer.java b/ccm-core/src/com/arsdigita/core/Initializer.java
index 719879c56..ffaae0598 100755
--- a/ccm-core/src/com/arsdigita/core/Initializer.java
+++ b/ccm-core/src/com/arsdigita/core/Initializer.java
@@ -39,7 +39,7 @@ import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
import com.arsdigita.ui.admin.Admin;
import com.arsdigita.ui.sitemap.SiteMap;
-import com.arsdigita.util.xml.XML;
+import com.arsdigita.xml.FactoriesSetup;
import com.arsdigita.web.Host;
import com.arsdigita.web.WebApp;
import com.arsdigita.web.ApplicationType;
@@ -130,13 +130,14 @@ public class Initializer extends CompoundInitializer {
}
});
- e.getFactory().registerInstantiator
+ e.getFactory().registerInstantiator
(BasicAuditTrail.BASE_DATA_OBJECT_TYPE,
- new DomainObjectInstantiator() {
- public DomainObject doNewInstance(final DataObject data) {
- return new BasicAuditTrail(data);
- }
- });
+ new DomainObjectInstantiator() {
+ public DomainObject doNewInstance(final DataObject data) {
+ return new BasicAuditTrail(data);
+ }
+ });
+
// register the document converters
Converter converter = new PDFConverter();
ConverterRegistry.registerConverter(converter,
@@ -168,6 +169,6 @@ public class Initializer extends CompoundInitializer {
CoreLoader.loadHost();
txn.commitTxn();
- XML.setupFactories();
+ FactoriesSetup.setupFactories();
}
}
diff --git a/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java b/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java
index ac8eede71..231cd1350 100755
--- a/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java
+++ b/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java
@@ -27,6 +27,7 @@ import com.arsdigita.util.parameter.ErrorList;
import com.arsdigita.util.parameter.ParameterContext;
import com.arsdigita.util.parameter.ParameterReader;
import com.arsdigita.xml.XML;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -37,10 +38,12 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import org.apache.log4j.Logger;
+
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
+import org.apache.log4j.Logger;
+
/**
* The ConfigRegistry class maps between config classes (subclasses of
* {@link com.arsdigita.runtime.AbstractConfig}), and a location used
diff --git a/ccm-core/src/com/arsdigita/util/Classes.java b/ccm-core/src/com/arsdigita/util/Classes.java
index a3cc28884..24d012e84 100755
--- a/ccm-core/src/com/arsdigita/util/Classes.java
+++ b/ccm-core/src/com/arsdigita/util/Classes.java
@@ -72,7 +72,7 @@ public final class Classes {
Assert.exists(clacc, Class.class);
Assert.exists(params, Class.class);
Assert.exists(values, Object.class);
- Assert.truth(params.length == values.length);
+ Assert.isTrue(params.length == values.length);
}
try {
diff --git a/ccm-core/src/com/arsdigita/util/xml/DOMBuilder.java b/ccm-core/src/com/arsdigita/util/xml/DOMBuilder.java
deleted file mode 100755
index 93ade5401..000000000
--- a/ccm-core/src/com/arsdigita/util/xml/DOMBuilder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 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.util.xml;
-
-public final class DOMBuilder {
-
- public static final String XERCES =
- "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
- public static final String RESIN =
- "com.caucho.xml.parsers.XmlDocumentBuilderFactory";
-
- public final static String get(String key) {
-
- // UGLY style, but sufficient for a temporay solution
-
- // Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc
- if(key.toLowerCase().equals("resin")) return RESIN;
- else return XERCES;
- }
-
-}
diff --git a/ccm-core/src/com/arsdigita/util/xml/SAXParser.java b/ccm-core/src/com/arsdigita/util/xml/SAXParser.java
deleted file mode 100755
index 563557c7c..000000000
--- a/ccm-core/src/com/arsdigita/util/xml/SAXParser.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 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.util.xml;
-
-
-public final class SAXParser {
- public static final String RESIN =
- "com.caucho.xml.parsers.XmlSAXParserFactory";
-
- public static final String XERCES =
- "org.apache.xerces.jaxp.SAXParserFactoryImpl";
-
- public final static String get(String key) {
-
- // UGLY style, but sufficient for a temporay solution
-
- // Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc
- if(key.toLowerCase().equals("resin")) return RESIN;
- else return XERCES;
- }
-
-}
diff --git a/ccm-core/src/com/arsdigita/util/xml/XMLConfig.java b/ccm-core/src/com/arsdigita/util/xml/XMLConfig.java
deleted file mode 100755
index 6739ef1e8..000000000
--- a/ccm-core/src/com/arsdigita/util/xml/XMLConfig.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 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.util.xml;
-
-import com.arsdigita.runtime.AbstractConfig;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.StringParameter;
-
-import org.apache.log4j.Logger;
-
-/**
- * A configuration record for the configuration of the XML factories:
- * - Document Builder
- * - Sax Parser
- * - XSL Transformer
- *
- */
-public final class XMLConfig extends AbstractConfig {
-
- public final static String versionId =
- "$Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $" +
- "$Author: sskracic $" +
- "$DateTime: 2004/08/16 18:10:38 $";
-
- private static final Logger s_log = Logger.getLogger
- (XMLConfig.class);
-
- private static XMLConfig s_config;
-
- /**
- * Returns the singleton configuration record for the XML factory
- * configuration.
- *
- * @return The XMLConfig record; it cannot be null
- */
- public static final synchronized XMLConfig getConfig() {
- if (s_config == null) {
- s_config = new XMLConfig();
- // read values from the persistent storage
- s_config.load();
- }
-
- return s_config;
- }
-
- // Obviously unfinished work and not helpful here. In any case we
- // have to handle just class names.
- // private final AliasedClassParameter m_xfmr;
- // private final AliasedClassParameter m_builder;
- // private final AliasedClassParameter m_parser;
- private final Parameter m_xfmr = new StringParameter
- ("waf.xml.xsl_transformer", Parameter.REQUIRED, "saxon");
-
- private final Parameter m_builder = new StringParameter
- ("waf.xml.dom_builder", Parameter.REQUIRED, "xerces");
-
- private final Parameter m_parser = new StringParameter
- ("waf.xml.sax_parser", Parameter.REQUIRED, "xerces");
-
-
-
- /**
- * Constructs an empty XMLConfig object following the singelton pattern.
- *
- * They are meant as an singelton pattern (with private constructor), but
- * it does not work with the associated classes AbstractConfig and
- * ConfigRegistry because they can currently not deal with a private constructor
- */
-
- // private XMLConfig() {
- public XMLConfig() {
-
- register(m_xfmr);
- register(m_builder);
- register(m_parser);
-
- loadInfo();
- }
-
-
- /* ************ public getter / setter section ************ */
-
-
- /**
- * Returns the XSL Transformer factory class name to use
- *
- * @return String XSL Transformer factory class name
- */
- public final String getXSLTransformerFactoryClassname() {
- return XSLTransformer.get( (String) get(m_xfmr) );
- }
-
- /**
- * Returns the Document Builder factory class name to use
- *
- * @return String Document Builder factory class name
- */
- public final String getDOMBuilderFactoryClassname() {
- return DOMBuilder.get( (String) get(m_builder) );
- }
-
- /**
- * Returns the Sax Parser factory class name to use
- *
- * @return String Sax Parser factory class name
- */
- public final String getSAXParserFactoryClassname() {
- return SAXParser.get( (String) get(m_parser) );
- }
-
-}
diff --git a/ccm-core/src/com/arsdigita/util/xml/XMLConfig_parameter.properties b/ccm-core/src/com/arsdigita/util/xml/XMLConfig_parameter.properties
deleted file mode 100755
index 9424ea7f2..000000000
--- a/ccm-core/src/com/arsdigita/util/xml/XMLConfig_parameter.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-waf.xml.xsl_transformer.title=XSLT transformer
-waf.xml.xsl_transformer.purpose=Define the XSLT transformer factory to use
-waf.xml.xsl_transformer.example=Choose one of: saxon (default)|jd.xslt|resin|xalan|xsltc
-waf.xml.xsl_transformer.format=[string]
-
-waf.xml.dom_builder.title=DOM builder
-waf.xml.dom_builder.purpose=Define the DOM builder factory to use
-waf.xml.dom_builder.example=Choose one of: xerces (default)|resin
-waf.xml.dom_builder.format=[string]
-
-waf.xml.sax_parser.title=SAX parser
-waf.xml.sax_parser.purpose=Define the SAX parser factory to use
-waf.xml.sax_parser.example=Choose one of: xerces (default)|resin
-waf.xml.sax_parser.format=[string]
-
diff --git a/ccm-core/src/com/arsdigita/util/xml/XSLTransformer.java b/ccm-core/src/com/arsdigita/util/xml/XSLTransformer.java
deleted file mode 100755
index 8de783d38..000000000
--- a/ccm-core/src/com/arsdigita/util/xml/XSLTransformer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 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.util.xml;
-
-public final class XSLTransformer {
- public static final String RESIN =
- "com.caucho.xsl.Xsl";
- public static final String JD_XSLT =
- "jd.xml.xslt.trax.TransformerFactoryImpl";
- public static final String XSLTC =
- "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
- public static final String SAXON =
- "com.icl.saxon.TransformerFactoryImpl";
- public static final String XALAN =
- "org.apache.xalan.processor.TransformerFactoryImpl";
-
- public final static String get(String key) {
-
- // UGLY style, but sufficient for a temporay solution
-
- // Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc
- if(key.toLowerCase().equals("xsltc")) return XSLTC;
- if(key.toLowerCase().equals("xalan")) return XALAN ;
- if(key.toLowerCase().equals("resin")) return RESIN;
- if(key.toLowerCase().equals("jd.xslt")) return JD_XSLT;
- // return defaultValue
- return SAXON;
-
- }
-}
diff --git a/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java b/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java
index 83434cab5..6dc575f07 100644
--- a/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java
+++ b/ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java
@@ -26,6 +26,7 @@ package com.arsdigita.web;
import com.arsdigita.runtime.CCMResourceManager;
import com.arsdigita.runtime.Startup;
// import com.arsdigita.util.ResourceManager;
+import com.arsdigita.xml.FactoriesSetup;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
@@ -94,7 +95,7 @@ public class CCMApplicationContextListener implements ServletContextListener {
//Configure log4j configuration file
m_log4j = sc.getInitParameter("log4j-conf-file");
- s_log.info("Logging context parameeter is: " + m_log4j);
+ s_log.info("Logging context parameter is: " + m_log4j);
// if the log4j-init-file is not set, then no point in trying
if(m_log4j != null) {
PropertyConfigurator.configure(m_appBase+m_log4j);
@@ -109,7 +110,10 @@ public class CCMApplicationContextListener implements ServletContextListener {
// ToDo: integrate both into a single class, e.g. CCMResourceManager
// to simplify and clean-up of the code!
CCMResourceManager.setBaseDirectory(m_appBase);
- s_log.info("CCMApplicationContextListener: BaseDir set to: " + m_appBase );
+ s_log.info("BaseDir set to: " + m_appBase );
+
+ // Setup the XML factory configuration
+ FactoriesSetup.setupFactories();
// Central startup procedure, initialize the database and
// domain coupling machinary
diff --git a/ccm-core/src/com/arsdigita/util/xml/XML.java b/ccm-core/src/com/arsdigita/xml/FactoriesSetup.java
similarity index 51%
rename from ccm-core/src/com/arsdigita/util/xml/XML.java
rename to ccm-core/src/com/arsdigita/xml/FactoriesSetup.java
index 9adeea618..a935c37ab 100755
--- a/ccm-core/src/com/arsdigita/util/xml/XML.java
+++ b/ccm-core/src/com/arsdigita/xml/FactoriesSetup.java
@@ -16,32 +16,53 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.util.xml;
+package com.arsdigita.xml;
import org.apache.log4j.Logger;
/**
- * Utility class to configure the XML parsers using Sun's javax.xml specified
- * classes and methods (in the javax.xml..... packages).
- *
- * Currently CCM uses a quite simple but rather thumb method of configuration.
- * It places the desired parser class names into the system environment
- * (previously by startup script, now by setProperties), where they are
- * picked up by the Sun provided classes.
- *
- * This method contrains all programs in a JVM (e.g. all instances of CCM in
- * a servlet container) to use the same configuration. Other methods are
- * available but we have to dig deeper into the CCM code.
+ * Utility class to configure the FactoriesSetup parsers using Sun's javax.xml
+ * specified classes and methods (in the javax.xml..... packages) and should be
+ * invokes as early as possible in the CCM startup process.
*
- * Called once by c.ad.core.Initializer at startup.
+ * Parsers rsp. transformers are created using a factory class. There are 2
+ * methods available:
+ *
+ * Static method newinstance()
+ * searches the configuration following 4 steps:
+ * 1. Use the javax.xml.parsers.[name]Factory system property
+ * 2. Use properties file "lib/jaxp.properties" in the JRE directory
+ * 3. Use the Services API, which will look in a file
+ * META-INF/services/javax.xml.parsers.[name]Factory
+ * in jars available to the runtime.
+ * 4. Platform default [name]Factory instance
+ *
+ * Static method newInstance(String factoryClassName, ClassLoader classLoader)
+ * Currently not used by CCM code. Refactoring requirred.
+ * C.f.
+ * http://www.docjar.com/html/api/javax/xml/parsers/DocumentBuilderFactory.java.html
+ *
+ * Previously CCM used to place the desired parser class names as runtime
+ * parameters (-D...) into the Tomcat startup script. This method requires a
+ * custom Tomcat configuration and constrains all other applications running in
+ * the servlet container to use the same configuration.
+ *
+ * The preferred method is the second option of newinstance, but
+ * requires to dig deeper into the CCM code.
+ *
+ * As an intermediate solution the implementation to use is stored in
+ * the configuration registry, read at startup and set as system.properties.
+ *
+ * Called once by c.ad.core.Initializer at startup and
+ * CCMApplicationContextListener.
*
* modified by
* @author pboy
*/
-public class XML {
+public class FactoriesSetup {
private static final Logger s_log = Logger.getLogger
- (XML.class);
+ (FactoriesSetup.class);
/* ************ public getter / setter section ************ */
@@ -85,4 +106,28 @@ public class XML {
}
}
}
+ /**
+ * Actually unfinished work.
+ *
+ * ToDo: Use an alternative Factory constructor of javax.xml. ... (e.g.
+ * DocumentBuilderFactory) which directly accepts a classname and a
+ * class loader, so we do not depend on a system wide configuration.
+ *
+ * @param impl the value of the class name of the factory to use
+ */
+// static void setupDomBuilderFactory( String implClass) {
+// if (implClass != null) {
+ // if (s_log.isInfoEnabled()) {
+ // s_log.info("Setting " + name + " to " + impl);
+ // }
+ // System.setProperty(name,
+ // impl);
+// } else {
+ // if (s_log.isInfoEnabled()) {
+ // s_log.info("Leaving " + name + " as " +
+ // System.getProperty(name));
+ // }
+// }
+// }
+
}
diff --git a/ccm-core/src/com/arsdigita/xml/XML.java b/ccm-core/src/com/arsdigita/xml/XML.java
index 8a03ab619..10bcad536 100755
--- a/ccm-core/src/com/arsdigita/xml/XML.java
+++ b/ccm-core/src/com/arsdigita/xml/XML.java
@@ -49,7 +49,7 @@ public class XML {
private static final Logger s_log = Logger.getLogger(XML.class);
- private static XMLConfig s_config;
+ // private static XMLConfig s_config;
private static Map s_formatters = new HashMap();
static {
@@ -60,7 +60,6 @@ public class XML {
/**
* Retrieves the current configuration
- */
public static XMLConfig getConfig() {
if (s_config == null) {
s_config = new XMLConfig();
@@ -68,6 +67,7 @@ public class XML {
}
return s_config;
}
+ */
/**
* Registers a formatter for serializing objects of a
diff --git a/ccm-core/src/com/arsdigita/xml/XMLConfig.java b/ccm-core/src/com/arsdigita/xml/XMLConfig.java
index 6bdf969d7..55cc708c3 100755
--- a/ccm-core/src/com/arsdigita/xml/XMLConfig.java
+++ b/ccm-core/src/com/arsdigita/xml/XMLConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Runtime Collective Ltd. All Rights Reserved.
+ * Copyright (C) 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
@@ -19,43 +19,163 @@
package com.arsdigita.xml;
import com.arsdigita.runtime.AbstractConfig;
-// import com.arsdigita.runtime.RuntimeConfig;
-// import com.arsdigita.util.Assert;
-import com.arsdigita.util.parameter.BooleanParameter;
-// import com.arsdigita.util.parameter.EnumerationParameter;
-// import com.arsdigita.util.parameter.ErrorList;
-// import com.arsdigita.util.parameter.IntegerParameter;
import com.arsdigita.util.parameter.Parameter;
-//import com.arsdigita.util.parameter.ParameterError;
+import com.arsdigita.util.parameter.BooleanParameter;
+import com.arsdigita.util.parameter.StringParameter;
import org.apache.log4j.Logger;
-// import java.util.Map;
-// import java.util.HashMap;
-// import java.util.Set;
-// import java.util.HashSet;
-
/**
- * Stores the configuration record for the XML functionality
+ * Stores the configuration record for the XML functionality.
+ *
+ * Most important: Configuration of the XML factories:
+ * - Document Builder
+ * - Sax Parser
+ * - XSL Transformer
+ *
*/
public final class XMLConfig extends AbstractConfig {
- private static Logger s_log = Logger.getLogger(XMLConfig.class);
+ public final static String versionId =
+ "$Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $" +
+ "$Author: sskracic $" +
+ "$DateTime: 2004/08/16 18:10:38 $";
- private Parameter m_activateFullTimeFormatter;
+ private static final Logger s_log = Logger.getLogger
+ (XMLConfig.class);
+ private static XMLConfig s_config;
+
+ // supported XSL transformer implementations
+ private static final String RESIN =
+ "com.caucho.xsl.Xsl";
+ private static final String JD_XSLT =
+ "jd.xml.xslt.trax.TransformerFactoryImpl";
+ private static final String XSLTC =
+ "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
+ private static final String SAXON =
+ "com.icl.saxon.TransformerFactoryImpl";
+ private static final String XALAN =
+ "org.apache.xalan.processor.TransformerFactoryImpl";
+
+ // supported documentBuilder implementations
+ private static final String DOM_XERCES =
+ "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
+ private static final String DOM_RESIN =
+ "com.caucho.xml.parsers.XmlDocumentBuilderFactory";
+
+ // supported SAX parser implementations
+ private static final String SAX_XERCES =
+ "org.apache.xerces.jaxp.SAXParserFactoryImpl";
+ private static final String SAX_RESIN =
+ "com.caucho.xml.parsers.XmlSAXParserFactory";
+
+ /**
+ * Returns the singleton configuration record for the XML functionality
+ *
+ * @return The XMLConfig record; it cannot be null
+ */
+ public static final synchronized XMLConfig getConfig() {
+ if (s_config == null) {
+ s_config = new XMLConfig();
+ // read values from the persistent storage
+ s_config.load();
+ }
+
+ return s_config;
+ }
+
+ private final Parameter m_xfmr = new StringParameter
+ ("waf.xml.xsl_transformer", Parameter.REQUIRED, "saxon");
+
+ private final Parameter m_builder = new StringParameter
+ ("waf.xml.dom_builder", Parameter.REQUIRED, "xerces");
+
+ private final Parameter m_parser = new StringParameter
+ ("waf.xml.sax_parser", Parameter.REQUIRED, "xerces");
+
+ private Parameter m_activateFullTimeFormatter = new BooleanParameter
+ ("waf.xml.activate_full_date_formatter",
+ Parameter.OPTIONAL, new Boolean(false));
+
+
+
+
+ /**
+ * Constructs an empty XMLConfig object following the singelton pattern.
+ *
+ * They are meant as an singelton pattern (with private constructor), but
+ * it does not work with the associated classes AbstractConfig and
+ * ConfigRegistry because they can currently not deal with a private constructor
+ */
+
+ // private XMLConfig() {
public XMLConfig() {
-
- m_activateFullTimeFormatter = new BooleanParameter
- ("waf.xml.activate_full_date_formatter",
- Parameter.OPTIONAL,
- new Boolean(false));
-
+
+ register(m_xfmr);
+ register(m_builder);
+ register(m_parser);
register(m_activateFullTimeFormatter);
loadInfo();
}
+
+ /* ************ public getter / setter section ************ */
+
+
+ /**
+ * Returns the XSL Transformer factory class name to use.
+ *
+ * The method assures that the return value is a valid class name.
+ *
+ * @return String XSL Transformer factory class name
+ */
+ public final String getXSLTransformerFactoryClassname() {
+
+ String m_key = (String) get(m_xfmr);
+
+ // Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc
+ if(m_key.toLowerCase().equals("xsltc")) return XSLTC;
+ if(m_key.toLowerCase().equals("xalan")) return XALAN ;
+ if(m_key.toLowerCase().equals("resin")) return RESIN;
+ if(m_key.toLowerCase().equals("jd.xslt")) return JD_XSLT;
+ // return defaultValue
+ return SAXON;
+ }
+
+ /**
+ * Returns the Document Builder factory class name to use
+ *
+ * The method assures that the return value is a valid class name.
+ *
+ * @return String Document Builder factory class name
+ */
+ public final String getDOMBuilderFactoryClassname() {
+
+ String m_key = (String) get(m_builder);
+
+ // Defined values: xerces (default)|resin
+ if(m_key.toLowerCase().equals("resin")) return DOM_RESIN;
+ else return DOM_XERCES;
+ }
+
+ /**
+ * Returns the Sax Parser factory class name to use.
+ *
+ * The method assures that the return value is a valid class name.
+ *
+ * @return String Sax Parser factory class name
+ */
+ public final String getSAXParserFactoryClassname() {
+
+ String m_key = (String) get(m_parser);
+
+ // Defined values: xerces (default)|resin
+ if(m_key.toLowerCase().equals("resin")) return SAX_RESIN;
+ else return SAX_XERCES;
+ }
+
/**
* Returns the activateFullTimeFormatter flag.
*/
@@ -69,4 +189,5 @@ public final class XMLConfig extends AbstractConfig {
public void setActivateFullTimeFormatter(boolean activateFullTimeFormatter) {
set (m_activateFullTimeFormatter,new Boolean(activateFullTimeFormatter));
}
+
}
diff --git a/ccm-core/src/com/arsdigita/xml/XMLConfig_parameter.properties b/ccm-core/src/com/arsdigita/xml/XMLConfig_parameter.properties
index 6869b0b06..4ba793c76 100755
--- a/ccm-core/src/com/arsdigita/xml/XMLConfig_parameter.properties
+++ b/ccm-core/src/com/arsdigita/xml/XMLConfig_parameter.properties
@@ -1,3 +1,18 @@
+waf.xml.xsl_transformer.title=XSLT transformer
+waf.xml.xsl_transformer.purpose=Define the XSLT transformer factory to use
+waf.xml.xsl_transformer.example=Choose one of: saxon (default)|jd.xslt|resin|xalan|xsltc
+waf.xml.xsl_transformer.format=[string]
+
+waf.xml.dom_builder.title=DOM builder
+waf.xml.dom_builder.purpose=Define the DOM builder factory to use
+waf.xml.dom_builder.example=Choose one of: xerces (default)|resin
+waf.xml.dom_builder.format=[string]
+
+waf.xml.sax_parser.title=SAX parser
+waf.xml.sax_parser.purpose=Define the SAX parser factory to use
+waf.xml.sax_parser.example=Choose one of: xerces (default)|resin
+waf.xml.sax_parser.format=[string]
+
waf.xml.activate_full_date_formatter.title=Activate FullDateFormatter
waf.xml.activate_full_date_formatter.purpose=Set this to true to make FullDateFormatter output semantic date XML; the XSL templates may need to be modified accordingly
waf.xml.activate_full_date_formatter.example=true
diff --git a/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java b/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java
index dd31b7035..e4dc6df75 100755
--- a/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java
+++ b/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java
@@ -21,6 +21,7 @@ package com.arsdigita.xml.formatters;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.xml.Formatter;
import com.arsdigita.xml.XML;
+import com.arsdigita.xml.XMLConfig;
import java.text.DateFormat;
import java.util.Calendar;
@@ -47,7 +48,7 @@ public class FullDateFormatter extends DateFormatter {
String parentResult = super.format(value);
- if (!XML.getConfig().getActivateFullTimeFormatter()) {
+ if (!XMLConfig.getConfig().getActivateFullTimeFormatter()) {
return parentResult;
}
diff --git a/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws
index fa23cc1c9..29ff94b80 100755
--- a/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws
+++ b/ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws
@@ -7,6 +7,14 @@
CCM
Content and Collaboration Management
+
+
+ log4j-conf-file
+ WEB-INF/conf/log4j.properties
+
+
+
shortcuts
com.arsdigita.london.shortcuts.ShortcutFilter
diff --git a/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws
index fa23cc1c9..29ff94b80 100755
--- a/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws
+++ b/ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws
@@ -7,6 +7,14 @@
CCM
Content and Collaboration Management
+
+
+ log4j-conf-file
+ WEB-INF/conf/log4j.properties
+
+
+
shortcuts
com.arsdigita.london.shortcuts.ShortcutFilter
diff --git a/ccm-zes-aplaws/bundles/devel/cfg/integration.properties b/ccm-zes-aplaws/bundles/devel/cfg/integration.properties
index 4c704dba7..f6ebdbfdb 100644
--- a/ccm-zes-aplaws/bundles/devel/cfg/integration.properties
+++ b/ccm-zes-aplaws/bundles/devel/cfg/integration.properties
@@ -22,6 +22,9 @@ waf.pagemap.login_redirect=content/content-center-redirect.jsp
waf.templating.stylesheet_resolver=com.arsdigita.templating.PatternStylesheetResolver
waf.templating.stylesheet_paths=/WEB-INF/resources/aplaws-stylesheet-paths.txt
+; Configures the xml processing
+waf.xml.xsl_transformer=xalan
+waf.xml.activate_full_date_formatter=true
com.arsdigita.cms.category_authoring_add_form=com.arsdigita.aplaws.ui.ItemCategoryPicker
diff --git a/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws b/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws
index 24d43462c..be52545f1 100644
--- a/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws
+++ b/ccm-zes-aplaws/web/WEB-INF/web.xml-aplaws
@@ -7,6 +7,13 @@
CCM ZeS
Content and Collaboration Management
+
+
+ log4j-conf-file
+ WEB-INF/conf/log4j.properties
+
+
+
+ todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/>
+ todir="${app.server.shared.dir}" preservelastmodified="true"/>
+ todir="${app.server.shared.dir}" preservelastmodified="true"/>
-
-
+ seems to be needed if sysproperty javax....xerces...SAYParser .... below is set.
+ -->
-
+
+