<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 1997-2010 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://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
    or packager/legal/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 packager/legal/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.

-->

<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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.glassfish.metro</groupId>
        <artifactId>bundles</artifactId>
        <version>2.1-b21</version>
    </parent>

    <artifactId>webservices-osgi</artifactId>
    <packaging>jar</packaging>
    <name>Metro Web Services Runtime OSGi Bundle</name>
    <description>Metro Web Services Runtime OSGi Bundle</description>

    <build>
        <plugins>
            <plugin> <!-- want to unpack sources from individual modules -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax.xml</groupId>
                                    <artifactId>jaxr-api</artifactId>
                                    <!--version>${project.version}</version-->
                                    <!--type>jar</type-->
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>webservices-rt</artifactId>
                                    <!--version>${project.version}</version-->
                                    <!--type>jar</type-->
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>webservices-extra</artifactId>
                                    <!--version>${project.version}</version-->
                                    <!--type>jar</type-->
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>webservices-tools</artifactId>
                                    <!--version>${project.version}</version-->
                                    <!--type>jar</type-->
                                    <classifier>sources</classifier>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${generated.sources.dir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${generated.sources.dir}</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>osgi-bundle</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                        <configuration>
                            <instructions>
                                <Export-Package>
                                    com.sun.istack.ws.*;version=${jaxws.ri.release.version},
                                    com.sun.tools.ws.*;version=${jaxws.ri.release.version},
                                    com.sun.wsit.security.*;version=${metro.release.version},
                                    com.sun.xml.messaging.saaj.*;version=1.3,
                                    com.sun.xml.registry.*;version=1.0,
                                    com.sun.xml.rpc.plugins;version=${metro.release.version},
                                    com.sun.xml.rpc.security;version=${metro.release.version},
                                    com.sun.xml.rpc.*;version=1.1.2,
                                    com.sun.xml.security.*;version=${metro.release.version},
                                    com.sun.xml.ws.api.config.management;version=${jaxws.ri.release.version},
                                    com.sun.xml.ws.api.config.management.policy;version=${jaxws.ri.release.version},
                                    com.sun.xml.ws.api.config.management.jmx;version=${metro.release.version},
                                    com.sun.xml.ws.api.security.*;version=${metro.release.version},
                                    com.sun.xml.ws.api.transport.tcp.*;version=${metro.release.version},
                                    com.sun.xml.ws.api.tx.*;version=${metro.release.version},
                                    com.sun.xml.ws.assembler.*;version=${metro.release.version},
                                    com.sun.xml.ws.commons.*;version=${metro.release.version},
                                    com.sun.xml.ws.config.management.policy.*;version=${jaxws.ri.release.version},
                                    com.sun.xml.ws.config.*;version=${metro.release.version},
                                    com.sun.xml.ws.metro.api.*;version=${metro.release.version},
                                    com.sun.xml.ws.policy.config.*;version=${metro.release.version},
                                    com.sun.xml.ws.policy.impl.bindings.*;version=${metro.release.version},
                                    com.sun.xml.ws.policy.jaxws.*;version=${jaxws.ri.release.version},
                                    com.sun.xml.ws.policy.jcaps.*;version=${metro.release.version},
                                    com.sun.xml.ws.policy.localization.*;version=${metro.release.version},
                                    com.sun.xml.ws.policy.parser.*;version=${metro.release.version},
                                    com.sun.xml.ws.runtime.*;version=${metro.release.version},
                                    com.sun.xml.ws.rx.*;version=${metro.release.version},
                                    com.sun.xml.ws.security.*;version=${metro.release.version},
                                    com.sun.xml.ws.transport.tcp.*;version=${metro.release.version},
                                    com.sun.xml.ws.*;version=${jaxws.ri.release.version},
                                    com.sun.xml.wss.*;version=${metro.release.version},
                                    javax.xml.registry.*;version=1.0,
                                </Export-Package>
                                <Import-Package>
                                    com.sun.appserv.server;resolution:=optional,
                                    com.sun.enterprise.security.*;resolution:=optional,
                                    com.sun.enterprise.transaction.*;resolution:=optional,
                                    com.sun.enterprise.web.*;resolution:=optional,
                                    com.sun.enterprise.webservice;resolution:=optional,
                                    com.sun.enterprise.webservice.monitoring;resolution:=optional,
                                    com.sun.mail.util;resolution:=optional,
                                    com.sun.msv.*;resolution:=optional,
                                    com.sun.org.apache.xml.internal.serialize;resolution:=optional,
                                    com.sun.xml.bind.api.impl;resolution:=optional,
                                    com.sun.xml.bind.serializer;resolution:=optional,
                                    com.sun.xml.bind.validator;resolution:=optional,
                                    com.sun.xml.rpc.*;resolution:=optional,
                                    com.sun.xml.ws.spi.runtime;resolution:=optional,
                                    javax.ejb;resolution:=optional;version=3.0,
                                    javax.jws;version=2.0,
                                    javax.jws.soap;version=2.0,
                                    javax.xml.ws.*;version=${jaxws.spec.version},
                                    javax.xml.bind.*;version=${jaxb.spec.version},
                                    org.apache.coyote;resolution:=optional,
                                    org.apache.tomcat.util.buf;resolution:=optional,
                                    org.iso_relax.verifier.impl;resolution:=optional,
                                    org.jvnet.mimepull;resolution:=optional,
                                    org.relaxng.datatype;resolution:=optional,
                                    *
                                </Import-Package>
                                <Private-Package>
                                    com.sun.xml.stream.*,
                                    com.sun.xml.xwss.*;version=${metro.release.version},
                                    javanet.staxutils.*
                                </Private-Package>
                                <DynamicImport-Package>
                                    org.glassfish.flashlight.provider
                                </DynamicImport-Package>
                                <!--
                                    Missing exports compared to old:
                                        com.sun.istack.ws; version=0.0.0
                                        com.sun.tools.resourcegen; version=0.0.0
                                        com.sun.tools.ws; version=0.0.0
                                        com.sun.tools.ws.ant; version=0.0.0
                                        com.sun.tools.ws.api; version=0.0.0
                                        com.sun.tools.ws.api.wsdl; version=0.0.0
                                        com.sun.tools.ws.processor; version=0.0.0
                                        com.sun.tools.ws.processor.generator; version=0.0.0
                                        com.sun.tools.ws.processor.model; version=0.0.0
                                        com.sun.tools.ws.processor.model.exporter; version=0.0.0
                                        com.sun.tools.ws.processor.model.java; version=0.0.0
                                        com.sun.tools.ws.processor.model.jaxb; version=0.0.0
                                        com.sun.tools.ws.processor.modeler; version=0.0.0
                                        com.sun.tools.ws.processor.modeler.annotation; version=0.0.0
                                        com.sun.tools.ws.processor.modeler.wsdl; version=0.0.0
                                        com.sun.tools.ws.processor.util; version=0.0.0
                                        com.sun.tools.ws.resources; version=0.0.0
                                        com.sun.tools.ws.util; version=0.0.0
                                        com.sun.tools.ws.wscompile; version=0.0.0
                                        com.sun.tools.ws.wsdl.document; version=0.0.0
                                        com.sun.tools.ws.wsdl.document.http; version=0.0.0
                                        com.sun.tools.ws.wsdl.document.jaxws; version=0.0.0
                                        com.sun.tools.ws.wsdl.document.mime; version=0.0.0
                                        com.sun.tools.ws.wsdl.document.schema; version=0.0.0
                                        com.sun.tools.ws.wsdl.document.soap; version=0.0.0
                                        com.sun.tools.ws.wsdl.framework; version=0.0.0
                                        com.sun.tools.ws.wsdl.parser; version=0.0.0
                                        com.sun.xml.registry; version=0.0.0
                                        com.sun.xml.registry.common; version=0.0.0
                                        com.sun.xml.registry.common.tools; version=0.0.0
                                        com.sun.xml.registry.common.tools.bindings_v3; version=0.0.0
                                        com.sun.xml.registry.common.tools.resources; version=0.0.0
                                        com.sun.xml.registry.common.util; version=0.0.0
                                        com.sun.xml.registry.service; version=0.0.0
                                        com.sun.xml.registry.uddi; version=0.0.0
                                        com.sun.xml.registry.uddi.bindings_v2_2; version=0.0.0
                                        com.sun.xml.registry.uddi.infomodel; version=0.0.0
                                        WEB-INF.wsdl; version=0.0.0
                                        WEB-INF.wsdls; version=0.0.0
                                        WEB-INF.wsdls.wsat10; version=0.0.0
                                        WEB-INF.wsdls.wsat11; version=0.0.0
                                        WEB-INF.wsdls.wsc10; version=0.0.0
                                        WEB-INF.wsdls.wsc11; version=0.0.0
                                -->
                            </instructions>
                            <unpackBundle>true</unpackBundle>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-meta-inf-entries</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeTransitive>true</excludeTransitive>
                            <includes>META-INF/services/*, META-INF/metro-default.xml, META-INF/jaxrpc/*</includes>
                            <excludes>META-INF/services/com.sun.tools.*, META-INF/services/javax.xml.bind.*, META-INF/services/javax.xml.stream.*, META-INF/services/org.*</excludes>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.directory}/classes/META-INF/MANIFEST.MF</manifestFile>
                        <manifestEntries>
                            <probe-provider-class-names>com.sun.xml.ws.transport.http.servlet.JAXWSRIDeploymentProbeProvider,com.sun.xml.ws.transport.http.servlet.JAXWSRIServletProbeProvider</probe-provider-class-names>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin> <!-- remove the generated src dir-->
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>clean-unpacked-src-dir</id>
                        <phase>install</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${generated.sources.dir}</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxr-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-rt</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-extra</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-tools</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>

        <!--
            Declaring OSGi dependecies:
            GF application client module somehow creates it's HK2 classpath using
            (also) the declared webservices-osgi maven module dependencies. Although
            this project does not really need these dependencies to build itself,
            not declaring these dependencies in webservices-osgi causes that GF
            appclient module cannot load some classes (e.g. mimepull) which makes
            some CTS smoke tests to fail
        -->

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-api-osgi</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxrpc-api-osgi</artifactId>
            <version>1.1-b01</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>webservices-extra-jdk-packages</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ctc.wstx</groupId>
            <artifactId>woodstox-osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jvnet</groupId>
            <artifactId>mimepull</artifactId>
        </dependency>
    </dependencies>
    <properties>
        <generated.sources.dir>${project.build.directory}/generated-sources</generated.sources.dir>
    </properties>
</project>
