Clean-up der XML packages, Entfernen der XML Factories aus den Startparametern von Tomcat. Konfiguration der Factories erfolgt aus dem Programm über setSystemProperties, andere Möglichkeiten erforderten ein tiefgreifendes Umschreiben des XML Handlings.
git-svn-id: https://svn.libreccm.org/ccm/trunk@184 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
0dce2ee598
commit
188fe56f55
|
|
@ -1,41 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<config class="com.arsdigita.runtime.RuntimeConfig"
|
||||
storage="ccm-core/runtime.properties"/>
|
||||
<config class="com.arsdigita.web.WebConfig"
|
||||
storage="ccm-core/web.properties"/>
|
||||
<config class="com.arsdigita.templating.TemplatingConfig"
|
||||
storage="ccm-core/templating.properties"/>
|
||||
<config class="com.arsdigita.kernel.KernelConfig"
|
||||
storage="ccm-core/kernel.properties"/>
|
||||
<config class="com.arsdigita.mail.MailConfig"
|
||||
storage="ccm-core/mail.properties"/>
|
||||
<config class="com.arsdigita.versioning.VersioningConfig"
|
||||
storage="ccm-core/versioning.properties"/>
|
||||
<config class="com.arsdigita.search.lucene.LuceneConfig"
|
||||
storage="ccm-core/lucene.properties"/>
|
||||
<config class="com.arsdigita.kernel.security.SecurityConfig"
|
||||
storage="ccm-core/security.properties"/>
|
||||
<config class="com.arsdigita.bebop.BebopConfig"
|
||||
storage="ccm-core/bebop.properties"/>
|
||||
<config class="com.arsdigita.dispatcher.DispatcherConfig"
|
||||
storage="ccm-core/dispatcher.properties"/>
|
||||
<config class="com.arsdigita.workflow.simple.WorkflowConfig"
|
||||
storage="ccm-core/workflow.properties"/>
|
||||
<config class="com.arsdigita.search.SearchConfig"
|
||||
storage="ccm-core/search.properties"/>
|
||||
<config class="com.arsdigita.util.xml.XMLConfig"
|
||||
storage="ccm-core/xml.properties"/>
|
||||
<config class="com.arsdigita.formbuilder.util.FormBuilderConfig"
|
||||
storage="ccm-core/formbuilder.properties"/>
|
||||
<config class="com.arsdigita.profiler.ProfilerConfig"
|
||||
storage="ccm-core/profiler.properties"/>
|
||||
<config class="com.arsdigita.xml.XMLConfig"
|
||||
storage="ccm-core/core-xml.properties"/>
|
||||
<config class="com.arsdigita.xml.formatters.DateFormatterConfig"
|
||||
storage="ccm-core/date-formatter.properties"/>
|
||||
<config class="com.arsdigita.domain.DomainConfig"
|
||||
storage="ccm-core/domain.properties"/>
|
||||
<config class="com.arsdigita.categorization.CategorizationConfig"
|
||||
storage="ccm-core/categorization.properties"/>
|
||||
<config class="com.arsdigita.dispatcher.DispatcherConfig"
|
||||
storage="ccm-core/dispatcher.properties"/>
|
||||
<config class="com.arsdigita.domain.DomainConfig"
|
||||
storage="ccm-core/domain.properties"/>
|
||||
<config class="com.arsdigita.formbuilder.util.FormBuilderConfig"
|
||||
storage="ccm-core/formbuilder.properties"/>
|
||||
<config class="com.arsdigita.kernel.KernelConfig"
|
||||
storage="ccm-core/kernel.properties"/>
|
||||
<config class="com.arsdigita.kernel.security.SecurityConfig"
|
||||
storage="ccm-core/security.properties"/>
|
||||
<config class="com.arsdigita.mail.MailConfig"
|
||||
storage="ccm-core/mail.properties"/>
|
||||
<config class="com.arsdigita.profiler.ProfilerConfig"
|
||||
storage="ccm-core/profiler.properties"/>
|
||||
<config class="com.arsdigita.runtime.RuntimeConfig"
|
||||
storage="ccm-core/runtime.properties"/>
|
||||
<config class="com.arsdigita.search.SearchConfig"
|
||||
storage="ccm-core/search.properties"/>
|
||||
<config class="com.arsdigita.search.lucene.LuceneConfig"
|
||||
storage="ccm-core/lucene.properties"/>
|
||||
<config class="com.arsdigita.templating.TemplatingConfig"
|
||||
storage="ccm-core/templating.properties"/>
|
||||
<config class="com.arsdigita.versioning.VersioningConfig"
|
||||
storage="ccm-core/versioning.properties"/>
|
||||
<config class="com.arsdigita.web.WebConfig"
|
||||
storage="ccm-core/web.properties"/>
|
||||
<config class="com.arsdigita.workflow.simple.WorkflowConfig"
|
||||
storage="ccm-core/workflow.properties"/>
|
||||
<config class="com.arsdigita.xml.XMLConfig"
|
||||
storage="ccm-core/xml.properties"/>
|
||||
<config class="com.arsdigita.xml.formatters.DateFormatterConfig"
|
||||
storage="ccm-core/date-formatter.properties"/>
|
||||
</registry>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 <code>XMLConfig</code> 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) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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]
|
||||
|
||||
|
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <code>javax.xml.parsers.[name]Factory</code> system property
|
||||
* 2. Use properties file "lib/jaxp.properties" in the JRE directory
|
||||
* 3. Use the Services API, which will look in a file
|
||||
* <code>META-INF/services/javax.xml.parsers.[name]Factory</code>
|
||||
* in jars available to the runtime.
|
||||
* 4. Platform default <code>[name]Factory</code> 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 <code>newinstance</code>, but
|
||||
* requires to dig deeper into the CCM code.
|
||||
*
|
||||
* As an <em>intermediate</em> 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));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <code>XMLConfig</code> 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@
|
|||
<display-name>CCM</display-name>
|
||||
<description>Content and Collaboration Management</description>
|
||||
|
||||
<!-- path and filename of the log4j user accessible config file
|
||||
WEB-INF/conf/log4j.properties is the built-in default value -->
|
||||
<context-param>
|
||||
<param-name>log4j-conf-file</param-name>
|
||||
<param-value>WEB-INF/conf/log4j.properties</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<filter>
|
||||
<filter-name>shortcuts</filter-name>
|
||||
<filter-class>com.arsdigita.london.shortcuts.ShortcutFilter</filter-class>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@
|
|||
<display-name>CCM</display-name>
|
||||
<description>Content and Collaboration Management</description>
|
||||
|
||||
<!-- path and filename of the log4j user accessible config file
|
||||
WEB-INF/conf/log4j.properties is the built-in default value -->
|
||||
<context-param>
|
||||
<param-name>log4j-conf-file</param-name>
|
||||
<param-value>WEB-INF/conf/log4j.properties</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<filter>
|
||||
<filter-name>shortcuts</filter-name>
|
||||
<filter-class>com.arsdigita.london.shortcuts.ShortcutFilter</filter-class>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,13 @@
|
|||
<display-name>CCM ZeS</display-name>
|
||||
<description>Content and Collaboration Management</description>
|
||||
|
||||
<!-- path and filename of the log4j user accessible config file
|
||||
WEB-INF/conf/log4j.properties is the built-in default value -->
|
||||
<context-param>
|
||||
<param-name>log4j-conf-file</param-name>
|
||||
<param-value>WEB-INF/conf/log4j.properties</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<!-- Require secure connection by redirect to host-port part
|
||||
of parameter waf.web.secure_server
|
||||
|
|
|
|||
|
|
@ -18,49 +18,35 @@
|
|||
<target name="install-tomcat">
|
||||
<echo>Installing app server into ${app.server.parent.dir}</echo>
|
||||
<unzip src="${app.server.bundles.zip}" dest="${app.server.parent.dir}"
|
||||
overwrite="true">
|
||||
overwrite="true">
|
||||
<patternset>
|
||||
<exclude name="**/ROOT/**" />
|
||||
</patternset>
|
||||
</unzip>
|
||||
<!-- Nolonger NEEDED!
|
||||
lib files are placed int the webapps WEB-INF dir now (or in a standard shared dir)
|
||||
<replaceregexp file="${app.server.conf.dir}/catalina.properties" match="shared.loader=(.*)"
|
||||
replace="shared.loader=\1,${catalina.base}/webapps/WEB-INF/classes,${catalina.base}/webapps/WEB-INF/lib/*.jar"
|
||||
byline="true" />
|
||||
-->
|
||||
|
||||
<!-- Copy additional files needed for operation -->
|
||||
<copy file="ccm-core/lib/xercesImpl.jar"
|
||||
todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/>
|
||||
todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/>
|
||||
<copy file="tools-ng/devel/lib/ojdbc14.jar"
|
||||
todir="${app.server.shared.dir}" preservelastmodified="true"/>
|
||||
todir="${app.server.shared.dir}" preservelastmodified="true"/>
|
||||
<copy file="tools-ng/devel/lib/postgresql-jdbc-8.2.506.jar"
|
||||
todir="${app.server.shared.dir}" preservelastmodified="true"/>
|
||||
todir="${app.server.shared.dir}" preservelastmodified="true"/>
|
||||
</target>
|
||||
|
||||
<target name="start">
|
||||
<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
|
||||
|
||||
<!-- nolonger needed ? (if anything works as expected)
|
||||
<sysproperty key="ccm.home" value="${ccm.home}" />
|
||||
<sysproperty key="ccm.conf" value="${webapp.registry.dir}" />
|
||||
<sysproperty key="com.arsdigita.util.Assert.enabled" value="true" />
|
||||
<sysproperty key="log4j.configuration" value="file:///${app.server..conf.dir}/log4j.xml" />
|
||||
<sysproperty key="java.protocol.handler.pkgs" value="${java.protocol.handler.pkgs}" />
|
||||
-->
|
||||
<!-- Required until URL protocol resource is replaced by ResourceParameter or startup.java
|
||||
is modified to handle the ccm extra protocol properly. Copy directy into java lib/ext!
|
||||
<sysproperty key="java.ext.dirs"
|
||||
value="${env.JAVA_HOME}/jre/lib/ext;${env.JAVA_HOME}/lib/ext;${app.server.home.dir}/lib/system" />
|
||||
-->
|
||||
<!-- nolonger needed ? (if anything works as expected)
|
||||
-->
|
||||
seems to be needed if sysproperty javax....xerces...SAYParser .... below is set.
|
||||
<sysproperty key="java.endorsed.dirs" value="${app.server.shared.dir}/endorsed" />
|
||||
-->
|
||||
|
||||
<!-- required to prevent Tomcat from using AElfred to check web.xml / taglibs -->
|
||||
<!-- Previously required to prevent Tomcat from using AElfred to check web.xml / taglibs -->
|
||||
<!-- seems to work now without, please comment in if something goes wrong with XML processing
|
||||
<sysproperty key="javax.xml.transform.TransformerFactory" value="com.icl.saxon.TransformerFactoryImpl" />
|
||||
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" />
|
||||
<sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl" />
|
||||
-->
|
||||
|
||||
<!-- standard parameter to Tomcat operation -->
|
||||
<sysproperty key="catalina.home" value="${app.server.home.dir}" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue