mirror of https://github.com/apache/openjpa.git
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
This commit is contained in:
parent
7268ed8f80
commit
c105fe6094
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
pathsep=" "/>
|
||||
<java
|
||||
classname="org.apache.openjpa.enhance.PCEnhancer">
|
||||
<arg line="-p persistence.xml"/>
|
||||
<arg line="${enhance.files}"/>
|
||||
<classpath>
|
||||
<path
|
||||
|
@ -111,5 +112,4 @@
|
|||
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue