[SM-3760|SM-3761]create OSGi bundle for JAXWS and JAXB2.3
diff --git a/jaxb-api-2.2/pom.xml b/jaxb-api-2.2/pom.xml
index 5ebdbc9..c8b7f23 100644
--- a/jaxb-api-2.2/pom.xml
+++ b/jaxb-api-2.2/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.servicemix.specs</groupId>
<artifactId>specs-pom</artifactId>
- <version>1-SNAPSHOT</version>
+ <version>1</version>
<relativePath>../specs-pom/pom.xml</relativePath>
</parent>
diff --git a/jaxb-api-2.3/pom.xml b/jaxb-api-2.3/pom.xml
new file mode 100644
index 0000000..50d476c
--- /dev/null
+++ b/jaxb-api-2.3/pom.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>specs-pom</artifactId>
+ <version>2-SNAPSHOT</version>
+ <relativePath>../specs-pom/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jaxb-api-2.3</artifactId>
+ <packaging>bundle</packaging>
+ <version>2.3_1-SNAPSHOT</version>
+ <name>Apache ServiceMix :: Specs :: JAXB API 2.3</name>
+
+ <scm>
+ <connection>scm:git:https://git-wip-us.apache.org/repos/asf/servicemix-specs.git</connection>
+ <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/servicemix-specs.git</developerConnection>
+ <url>https://git-wip-us.apache.org/repos/asf?p=servicemix-specs.git</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.locator</artifactId>
+ <version>2.9.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
+ <version>2.9.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.1_spec</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Description>${project.description}</Bundle-Description>
+ <Export-Package>javax.xml.bind*;version=2.3;-split-package:=merge-first;-noimport:=true</Export-Package>
+ <Import-Package>*</Import-Package>
+ <Private-Package>org.apache.servicemix.specs.locator;-split-package:=merge-first</Private-Package>
+ <Bundle-Activator>org.apache.servicemix.specs.locator.Activator</Bundle-Activator>
+ <Implementation-Title>Apache ServiceMix</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ </instructions>
+ <unpackBundle>true</unpackBundle>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.apache.servicemix.specs:org.apache.servicemix.specs.locator</include>
+ <include>javax.xml.bind:jaxb-api</include>
+ </includes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>javax.xml.bind:jaxb-api</artifact>
+ <excludes>
+ <exclude>javax/**</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>org.apache.servicemix.specs:org.apache.servicemix.specs.locator</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <createSourcesJar>${createSourcesJar}</createSourcesJar>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>deploy</id>
+ <properties>
+ <createSourcesJar>true</createSourcesJar>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.locator</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <sourcepath>${project.build.directory}/sources</sourcepath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/jaxb-api-2.3/src/main/java/javax/xml/bind/ServiceLoaderUtil.java b/jaxb-api-2.3/src/main/java/javax/xml/bind/ServiceLoaderUtil.java
new file mode 100644
index 0000000..4debc31
--- /dev/null
+++ b/jaxb-api-2.3/src/main/java/javax/xml/bind/ServiceLoaderUtil.java
@@ -0,0 +1,153 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://oss.oracle.com/licenses/CDDL+GPL-1.1
+ * or LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package javax.xml.bind;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.ServiceLoader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Shared ServiceLoader/FactoryFinder Utils shared among SAAJ, JAXB and JAXWS
+ * - this class must be duplicated to all those projects, but it's
+ * basically generic code and we want to have it everywhere same.
+ *
+ * @author Miroslav.Kos@oracle.com
+ */
+class ServiceLoaderUtil {
+
+
+ static <P, T extends Exception> P firstByServiceLoader(Class<P> spiClass,
+ Logger logger,
+ ExceptionHandler<T> handler) throws T {
+ // service discovery
+ try {
+ ServiceLoader<P> serviceLoader = ServiceLoader.load(spiClass);
+
+ for (P impl : serviceLoader) {
+ logger.fine("ServiceProvider loading Facility used; returning object [" +
+ impl.getClass().getName() + "]");
+
+ return impl;
+ }
+ } catch (Throwable t) {
+ throw handler.createException(t, "Error while searching for service [" + spiClass.getName() + "]");
+ }
+ return null;
+ }
+
+ static void checkPackageAccess(String className) {
+ // make sure that the current thread has an access to the package of the given name.
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ int i = className.lastIndexOf('.');
+ if (i != -1) {
+ s.checkPackageAccess(className.substring(0, i));
+ }
+ }
+ }
+
+ static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
+ if (classLoader == null) {
+ return Class.forName(className);
+ } else {
+ return classLoader.loadClass(className);
+ }
+ }
+
+ // Returns instance of required class. It checks package access (security)
+ // unless it is defaultClassname. It means if you are trying to instantiate
+ // default implementation (fallback), pass the class name to both first and second parameter.
+ static <T extends Exception> Object newInstance(String className,
+ String defaultImplClassName,
+ final ExceptionHandler<T> handler) throws T {
+ try {
+ return safeLoadClass(className, defaultImplClassName, contextClassLoader(handler)).newInstance();
+ } catch (ClassNotFoundException x) {
+ throw handler.createException(x, "Provider " + className + " not found");
+ } catch (Exception x) {
+ throw handler.createException(x, "Provider " + className + " could not be instantiated: " + x);
+ }
+ }
+
+ static Class safeLoadClass(String className,
+ String defaultImplClassName,
+ ClassLoader classLoader) throws ClassNotFoundException {
+ // using OSGi locator to load the spi class
+ try {
+ Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(JAXBContext.class);
+ if (spiClass != null) {
+ return spiClass;
+ }
+ } catch (Throwable t) {
+ }
+
+
+ try {
+ checkPackageAccess(className);
+ } catch (SecurityException se) {
+ // anyone can access the platform default factory class without permission
+ if (defaultImplClassName != null && defaultImplClassName.equals(className)) {
+ return Class.forName(className);
+ }
+ // not platform default implementation ...
+ throw se;
+ }
+ return nullSafeLoadClass(className, classLoader);
+ }
+
+ static ClassLoader contextClassLoader(ExceptionHandler exceptionHandler) throws Exception {
+ try {
+ return Thread.currentThread().getContextClassLoader();
+ } catch (Exception x) {
+ throw exceptionHandler.createException(x, x.toString());
+ }
+ }
+
+ static abstract class ExceptionHandler<T extends Exception> {
+
+ public abstract T createException(Throwable throwable, String message);
+
+ }
+
+}
diff --git a/jaxws-api-2.3/pom.xml b/jaxws-api-2.3/pom.xml
new file mode 100644
index 0000000..965dd56
--- /dev/null
+++ b/jaxws-api-2.3/pom.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>specs-pom</artifactId>
+ <version>2-SNAPSHOT</version>
+ <relativePath>../specs-pom/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jaxws-api-2.3</artifactId>
+ <packaging>bundle</packaging>
+ <version>2.3_1-SNAPSHOT</version>
+ <name>Apache ServiceMix :: Specs :: JAXWS API 2.3</name>
+
+ <scm>
+ <connection>scm:git:https://git-wip-us.apache.org/repos/asf/servicemix-specs.git</connection>
+ <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/servicemix-specs.git</developerConnection>
+ <url>https://git-wip-us.apache.org/repos/asf?p=servicemix-specs.git</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jaxb-api-2.3</artifactId>
+ <version>2.3_1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.saaj-api-1.3</artifactId>
+ <version>2.9.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
+ <version>2.9.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.locator</artifactId>
+ <version>2.9.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Description>${project.description}</Bundle-Description>
+ <Export-Package>javax.xml.ws*;version=2.3;-split-package:=merge-first;-noimport:=true</Export-Package>
+ <Import-Package>!org.apache.geronimo.osgi*, *</Import-Package>
+ <Private-Package>org.apache.servicemix.specs.locator;-split-package:=merge-first</Private-Package>
+ <Bundle-Activator>org.apache.servicemix.specs.locator.Activator</Bundle-Activator>
+ <Implementation-Title>Apache ServiceMix</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ </instructions>
+ <unpackBundle>true</unpackBundle>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>javax.xml.ws:jaxws-api</include>
+ <include>org.apache.servicemix.specs:org.apache.servicemix.specs.locator</include>
+ </includes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>javax.xml.ws:jaxws-api</artifact>
+ <excludes>
+ <exclude>javax/**</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>org.apache.servicemix.specs:org.apache.servicemix.specs.locator</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <createSourcesJar>${createSourcesJar}</createSourcesJar>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>deploy</id>
+ <properties>
+ <createSourcesJar>true</createSourcesJar>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.locator</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <sourcepath>${project.build.directory}/sources</sourcepath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/jaxws-api-2.3/src/main/java/javax/xml/ws/spi/FactoryFinder.java b/jaxws-api-2.3/src/main/java/javax/xml/ws/spi/FactoryFinder.java
new file mode 100644
index 0000000..e984fc2
--- /dev/null
+++ b/jaxws-api-2.3/src/main/java/javax/xml/ws/spi/FactoryFinder.java
@@ -0,0 +1,177 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2005-2017 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://oss.oracle.com/licenses/CDDL+GPL-1.1
+ * or LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+
+package javax.xml.ws.spi;
+
+import java.io.*;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
+class FactoryFinder {
+
+ private static final Logger logger = Logger.getLogger("javax.xml.ws");
+
+ private static final ServiceLoaderUtil.ExceptionHandler<WebServiceException> EXCEPTION_HANDLER =
+ new ServiceLoaderUtil.ExceptionHandler<WebServiceException>() {
+ @Override
+ public WebServiceException createException(Throwable throwable, String message) {
+ return new WebServiceException(message, throwable);
+ }
+ };
+
+ /**
+ * Finds the implementation {@code Class} object for the given
+ * factory name, or if that fails, finds the {@code Class} object
+ * for the given fallback class name. The arguments supplied MUST be
+ * used in order. If using the first argument is successful, the second
+ * one will not be used.
+ * <P>
+ * This method is package private so that this code can be shared.
+ *
+ * @return the {@code Class} object of the specified message factory;
+ * may not be {@code null}
+ *
+ * @param factoryClass the name of the factory to find, which is
+ * a system property
+ * @param fallbackClassName the implementation class name, which is
+ * to be used only if nothing else
+ * is found; {@code null} to indicate that
+ * there is no fallback class name
+ * @exception WebServiceException if there is an error
+ */
+ @SuppressWarnings("unchecked")
+ static <T> T find(Class<T> factoryClass, String fallbackClassName) {
+ ClassLoader classLoader = ServiceLoaderUtil.contextClassLoader(EXCEPTION_HANDLER);
+
+ try {
+ String iFactoryId = factoryClass.getName();
+ // If we are deployed into an OSGi environment, leverage it
+ Class ifactoryClass = null;
+ if (FactoryFinder.class.getClassLoader() != null) {
+ ifactoryClass = FactoryFinder.class.getClassLoader().loadClass(iFactoryId);
+ } else {
+ ifactoryClass = Class.forName(iFactoryId);
+ }
+ Class spiClass = org.apache.servicemix.specs.locator.OsgiLocator.locate(ifactoryClass, iFactoryId);
+ if (spiClass != null) {
+ logger.log(Level.FINE, "Found spiClass: " + spiClass);
+ return (T)spiClass.newInstance();
+ } else {
+ logger.log(Level.FINE, "No spiClass found in OSGi");
+ }
+ } catch (Throwable e) {
+ logger.log(Level.FINE, "something is wrong when trying to locate class in OSGi", e);
+ }
+
+
+ T provider = ServiceLoaderUtil.firstByServiceLoader(factoryClass, logger, EXCEPTION_HANDLER);
+ if (provider != null) return provider;
+
+ String factoryId = factoryClass.getName();
+
+ // try to read from $java.home/lib/jaxws.properties
+ provider = (T) fromJDKProperties(factoryId, fallbackClassName, classLoader);
+ if (provider != null) return provider;
+
+ // Use the system property
+ provider = (T) fromSystemProperty(factoryId, fallbackClassName, classLoader);
+ if (provider != null) return provider;
+
+ if (fallbackClassName == null) {
+ throw new WebServiceException(
+ "Provider for " + factoryId + " cannot be found", null);
+ }
+
+ return (T) ServiceLoaderUtil.newInstance(fallbackClassName,
+ fallbackClassName, classLoader, EXCEPTION_HANDLER);
+ }
+
+ private static Object fromSystemProperty(String factoryId,
+ String fallbackClassName,
+ ClassLoader classLoader) {
+ try {
+ String systemProp = System.getProperty(factoryId);
+ if (systemProp != null) {
+ return ServiceLoaderUtil.newInstance(systemProp,
+ fallbackClassName, classLoader, EXCEPTION_HANDLER);
+ }
+ } catch (SecurityException ignored) {
+ }
+ return null;
+ }
+
+ private static Object fromJDKProperties(String factoryId,
+ String fallbackClassName,
+ ClassLoader classLoader) {
+ Path path = null;
+ try {
+ String JAVA_HOME = System.getProperty("java.home");
+ path = Paths.get(JAVA_HOME, "conf", "jaxws.properties");
+
+ // to ensure backwards compatibility
+ if (!Files.exists(path)) {
+ path = Paths.get(JAVA_HOME, "lib", "jaxws.properties");
+ }
+
+ if (Files.exists(path)) {
+ Properties props = new Properties();
+ try (InputStream inStream = Files.newInputStream(path)) {
+ props.load(inStream);
+ }
+ String factoryClassName = props.getProperty(factoryId);
+ return ServiceLoaderUtil.newInstance(factoryClassName,
+ fallbackClassName, classLoader, EXCEPTION_HANDLER);
+ }
+ } catch (Exception ignored) {
+ logger.log(Level.SEVERE, "Error reading JAX-WS configuration from [" + path +
+ "] file. Check it is accessible and has correct format.", ignored);
+ }
+ return null;
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 8f4d7b5..2bebc93 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,8 @@
<modules>
<module>annotation-api-1.2</module>
<module>annotation-api-1.3</module>
+ <module>jaxws-api-2.3</module>
+ <module>jaxb-api-2.3</module>
</modules>
</project>
diff --git a/specs-pom/pom.xml b/specs-pom/pom.xml
index 6fc6f00..50cf303 100644
--- a/specs-pom/pom.xml
+++ b/specs-pom/pom.xml
@@ -108,8 +108,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.8</source>
+ <target>1.8</target>
<maxmem>256M</maxmem>
<fork>${compiler.fork}</fork>
</configuration>
@@ -330,4 +330,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>