Author: rmannibucau
Date: Mon Jan 7 21:15:50 2013
New Revision: 1430015
URL: http://svn.apache.org/viewvc?rev=1430015&view=rev
Log:
TOMEE-455 using javaee-api 6.0-5-SNAPSHOT + initializing datatypeconverter
Modified:
openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
openejb/trunk/openejb/tomee/tomee-webapp/pom.xml
Modified:
openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java?rev=1430015&r1=1430014&r2=1430015&view=diff
==============================================================================
---
openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
(original)
+++
openejb/trunk/openejb/tomee/tomee-common/src/main/java/org/apache/tomee/installer/Installer.java
Mon Jan 7 21:15:50 2013
@@ -25,7 +25,9 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Method;
+import java.util.Arrays;
import java.util.LinkedList;
+import java.util.List;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -243,8 +245,10 @@ public class Installer {
copyClasses(paths.getJavaEEAPIJar(), new File(endorsed,
"annotation-api.jar"), "javax/annotation/.*");
- // a bit odd but we don't want to depend on OSGi and geronimo jaxb api
ContextFinder depends on it
- copyClasses(paths.getJavaEEAPIJar(), new File(endorsed,
"jaxb-api.jar"), "javax/xml/bind/.*");
+ final File jaxbApi = paths.findOpenEJBJar("geronimo-jaxb_2.2_spec");
+ copyClasses(paths.getJavaEEAPIJar(), jaxbApi, new File(endorsed,
"jaxb-api.jar"), "javax/xml/bind/.*",
Arrays.asList("javax/xml/bind/ContextFinder.class",
"javax/xml/bind/DatatypeConverter.class"));
+ removeJar(jaxbApi);
+
final File jaxbImpl = new File(endorsed, "jaxb-impl.jar");
if (!jaxbImpl.exists()) {
try {
@@ -303,6 +307,54 @@ public class Installer {
*/
}
+ private void copyClasses(final File javaEEAPIJar, final File sourceJar,
final File destinationJar, final String pattern, final List<String> exceptions)
{
+ if (javaEEAPIJar == null) throw new
NullPointerException("javaEEAPIJar");
+ if (sourceJar == null) throw new NullPointerException("sourceJar");
+ if (destinationJar == null) throw new
NullPointerException("destinationJar");
+ if (pattern == null) throw new NullPointerException("pattern");
+ if (exceptions == null) throw new NullPointerException("exceptions");
+
+ if (destinationJar.exists()) return;
+
+ try {
+
+ final ByteArrayOutputStream destinationBuffer = new
ByteArrayOutputStream(524288);
+ final ZipOutputStream destination = new
ZipOutputStream(destinationBuffer);
+
+ final ZipInputStream source = new
ZipInputStream(IO.read(sourceJar));
+ for (ZipEntry entry; (entry = source.getNextEntry()) != null; ) {
+ final String entryName = entry.getName();
+ if (!entryName.matches(pattern) ||
exceptions.contains(entryName)) {
+ continue;
+ }
+
+ destination.putNextEntry(new ZipEntry(entryName));
+
+ IO.copy(source, destination);
+ }
+ IO.close(source);
+
+ final ZipInputStream source2 = new
ZipInputStream(IO.read(javaEEAPIJar));
+ for (ZipEntry entry; (entry = source2.getNextEntry()) != null; ) {
+ final String entryName = entry.getName();
+ if (!entryName.matches(pattern) ||
!exceptions.contains(entryName)) {
+ continue;
+ }
+
+ destination.putNextEntry(new ZipEntry(entryName));
+
+ IO.copy(source2, destination);
+ }
+ IO.close(source2);
+
+ IO.close(destination);
+
+ IO.copy(destinationBuffer.toByteArray(), destinationJar);
+ } catch (IOException e) {
+ alerts.addError(e.getMessage());
+ }
+ }
+
private void copyClasses(File sourceJar, File destinationJar, String
pattern) {
if (sourceJar == null) throw new NullPointerException("sourceJar");
if (destinationJar == null) throw new
NullPointerException("destinationJar");
@@ -336,17 +388,20 @@ public class Installer {
}
}
-
- private void removeTomcatLibJar(String name) {
- File annotationApi = new File(paths.getCatalinaLibDir(), name);
- if (annotationApi.exists()) {
- if (!annotationApi.delete()) {
- annotationApi.deleteOnExit();
+ private void removeJar(final File jar) {
+ if (jar.exists()) {
+ if (!jar.delete()) {
+ jar.deleteOnExit();
}
- alerts.addInfo("Please restart the server or delete manually " +
name);
+ alerts.addInfo("Please restart the server or delete manually " +
jar.getName());
}
}
+ private void removeTomcatLibJar(String name) {
+ final File jar = new File(paths.getCatalinaLibDir(), name);
+ removeJar(jar);
+ }
+
public void installListener() {
installListener("org.apache.tomee.loader.OpenEJBListener");
}
Modified: openejb/trunk/openejb/tomee/tomee-webapp/pom.xml
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/pom.xml?rev=1430015&r1=1430014&r2=1430015&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/pom.xml (original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/pom.xml Mon Jan 7 21:15:50 2013
@@ -81,6 +81,12 @@
<artifactId>gson</artifactId>
<version>2.1</version>
</dependency>
+ <dependency> <!-- will be moved over endorsed dir so simply adding it
alone (= not in javaee-api) -->
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxb_2.2_spec</artifactId>
+ <version>1.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.javamail</groupId>
<artifactId>geronimo-javamail_1.4_mail</artifactId>