From c105fe6094531558832760a4eafc1218aff30714 Mon Sep 17 00:00:00 2001 From: "A. Abram White" Date: Fri, 28 Jul 2006 18:12:02 +0000 Subject: [PATCH] Pass "-p persistence.xml" to enhancer invocation when running persistence tests so that we don't have to set JPA defaults in the JPA ConfigurationProviderImpl.beforeConfigurationLoad, which is incompatible with having JDO,etc providers in the same system. Eventually we should probably recognize persistence.xml as a defaults file, but for now that's against our previous contract of allowing a user to have a JDO,etc defaults file and a persistence.xml in the same system. Also removed XML Transformer functionality from XMLFactory, since we don't use it and it causes problems with Ant (this seems to be an Ant+JDK 1.5 bug in Ant). git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@426634 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/openjpa/lib/xml/XMLFactory.java | 50 ------------------- .../apache/openjpa/lib/xml/TestXMLWriter.java | 3 +- openjpa-persistence-jdbc/pom.xml | 2 +- .../PersistenceProductDerivation.java | 2 - 4 files changed, 3 insertions(+), 54 deletions(-) diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/xml/XMLFactory.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/xml/XMLFactory.java index e77fafc28..a9212e560 100644 --- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/xml/XMLFactory.java +++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/xml/XMLFactory.java @@ -20,13 +20,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.Source; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; import org.apache.commons.lang.exception.NestableRuntimeException; import org.w3c.dom.Document; @@ -73,9 +67,6 @@ public class XMLFactory { _domFactories[arrIdx] = domFactory; } } - - _transFactory = (SAXTransformerFactory) TransformerFactory. - newInstance(); _validating = new ValidatingErrorHandler(); } @@ -130,47 +121,6 @@ public class XMLFactory { return getDOMParser(false, false).newDocument(); } - /** - * Return a Transformer that will apply the XSL transformation - * from the given source. If the source is null, - * no transformation will be applied. - */ - public static Transformer getTransformer(Source source) { - try { - if (source == null) - return _transFactory.newTransformer(); - return _transFactory.newTransformer(source); - } catch (TransformerConfigurationException tfce) { - throw new NestableRuntimeException(tfce); - } - } - - /** - * Return a Templates for the given XSL source. - */ - public static Templates getTemplates(Source source) { - try { - return _transFactory.newTemplates(source); - } catch (TransformerConfigurationException tfce) { - throw new NestableRuntimeException(tfce); - } - } - - /** - * Return a TransformerHandler for transforming SAX events, applying the - * XSL transform from the given source. If the source is null, no - * transform will be applied. - */ - public static TransformerHandler getTransformerHandler(Source source) { - try { - if (source == null) - return _transFactory.newTransformerHandler(); - return _transFactory.newTransformerHandler(source); - } catch (TransformerConfigurationException tfce) { - throw new NestableRuntimeException(tfce); - } - } - /** * Return the array index of the factory with the given properties. */ diff --git a/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java b/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java index 7ade5cffe..b3201ec37 100644 --- a/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java +++ b/openjpa-lib/src/test/java/org/apache/openjpa/lib/xml/TestXMLWriter.java @@ -15,6 +15,7 @@ package org.apache.openjpa.lib.xml; import java.io.InputStreamReader; import java.io.StringWriter; import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; @@ -48,7 +49,7 @@ public class TestXMLWriter extends TestCase { StringWriter formatted = new StringWriter(); StreamResult result = new StreamResult(new XMLWriter(formatted)); - Transformer trans = XMLFactory.getTransformer(null); + Transformer trans = TransformerFactory.newInstance().newTransformer(); trans.transform(source, result); // read the correct output into a buffer diff --git a/openjpa-persistence-jdbc/pom.xml b/openjpa-persistence-jdbc/pom.xml index f886c7b98..8af7ef094 100644 --- a/openjpa-persistence-jdbc/pom.xml +++ b/openjpa-persistence-jdbc/pom.xml @@ -90,6 +90,7 @@ pathsep=" "/> + - diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java index 898f647b9..5c58ac3f0 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java @@ -48,8 +48,6 @@ public class PersistenceProductDerivation PersistenceMetaDataFactory.class.getName()); conf.metaFactoryPlugin.setAlias(ALIAS_EJB, PersistenceMetaDataFactory.class.getName()); - conf.metaFactoryPlugin.setDefault(SPEC_JPA); - conf.metaFactoryPlugin.setString(SPEC_JPA); } public void afterSpecificationSet(OpenJPAConfiguration c) {