<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2010-2013 Evolveum
  ~
  ~ Licensed 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.
  -->

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <name>midPoint Model - api client</name>
    <groupId>com.evolveum.midpoint.model</groupId>
    <artifactId>model-client</artifactId>
    <packaging>jar</packaging>
    <parent>
        <artifactId>model</artifactId>
        <groupId>com.evolveum.midpoint</groupId>
        <version>3.2</version>
    </parent>
    <scm>
        <connection>https://github.com/Evolveum/midpoint.git</connection>
        <developerConnection>git@github.com:Evolveum/midpoint.git</developerConnection>
        <url>https://fisheye.evolveum.com/browse/midPoint</url>
    </scm>
    <distributionManagement>
      <repository>
        <id>evolveum-nexus</id>
        <name>Internal Releases</name>
        <url>http://nexus.evolveum.com/nexus/content/repositories/releases/</url>
      </repository>
      <snapshotRepository>
        <id>evolveum-nexus</id>
        <name>Internal Releases</name>
        <url>http://nexus.evolveum.com/nexus/content/repositories/snapshots/</url>
      </snapshotRepository>
    </distributionManagement>

    <dependencies>
    	<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
		</dependency>
		<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
        </dependency>
        <dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-ws-security</artifactId>
		</dependency>
		<dependency>
            <groupId>org.apache.cxf.xjc-utils</groupId>
            <artifactId>cxf-xjc-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
        </dependency>
        <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
        </dependency>
        <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-core</artifactId>
        </dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
		</dependency>
        <!-- This is needed only for equals methods. Simplify it now
        <dependency>
            <groupId>com.evolveum.midpoint.infra</groupId>
            <artifactId>util</artifactId>
            <version>2.3</version>
        </dependency>         -->
        <!--  Testing dependecies  -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>com.evolveum.midpoint.tools</groupId>
            <artifactId>test-ng</artifactId>
            <version>3.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
    	<resources>
        	<resource>
            	<directory>src/main/resources</directory>
            </resource>
            <resource>
            	<directory>target/midpoint-schema</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <!-- Used to pull XSD files from the JAR -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-schema-files</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.evolveum.midpoint.infra</groupId>
                                    <artifactId>prism</artifactId>
                                    <version>3.2</version>
                                    <type>jar</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.evolveum.midpoint.infra</groupId>
                                    <artifactId>schema</artifactId>
                                    <version>3.2</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                            <includes>**/*.xsd,**/*.dtd,**/*.wsdl</includes>
                            <outputDirectory>${project.basedir}/target/midpoint-schema</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- <plugin>
                   <groupId>org.jvnet.jaxb2.maven2</groupId>
                   <artifactId>maven-jaxb2-plugin</artifactId>
                   <version>0.7.0</version>
                   <executions>
                       <execution>
                           <goals>
                               <goal>generate</goal>
                           </goals>
                       </execution>
                   </executions>
                   <configuration>
                       <args>
                           <arg>-XtoString</arg>
                           <arg>-Xequals</arg>
                           <arg>-XhashCode</arg>
                           <arg>-Xcopyable</arg>
                           <arg>-Xmergeable</arg>
                       </args>
                       <plugins>
                           <plugin>
                               <groupId>org.jvnet.jaxb2_commons</groupId>
                               <artifactId>jaxb2-basics</artifactId>
                               <version>0.6.3</version>
                           </plugin>
                       </plugins>
                   </configuration>
               </plugin>  -->
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                            <wsdlRoot>${project.directory}/target/midpoint-schema</wsdlRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>target/midpoint-schema/xml/ns/private/model/modelWrapper.wsdl</wsdl>
                                    <wsdlLocation>classpath:xml/ns/private/model/modelWrapper.wsdl</wsdlLocation>
                                    <catalog>${basedir}/src/compile/resources/jax-ws-catalog.xml</catalog>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-xjc-Xts</extraarg>
<!--                                        <extraarg>-xjc-XhashCode</extraarg>
                                        <extraarg>-xjc-Xequals</extraarg>
                                          <extraarg>
                                            -xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
                                        </extraarg>-->
                                    </extraargs>
                                </wsdlOption>
                                <wsdlOption>
                                    <!-- Ugly hack. The fake WSDL includes all the XSD files we need to compile
                                                  This is the only way I found to generate equals and hashCode methods with CXF.
                                                  If you find anything better please correct it. -->
                                    <wsdl>target/midpoint-schema/xml/ns/private/fake/fakeWrapper.wsdl</wsdl>
                                    <catalog>${basedir}/src/compile/resources/jax-ws-catalog.xml</catalog>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-xjc-Xts</extraarg>
<!--                                        <extraarg>-xjc-XhashCode</extraarg>
                                         <extraarg>
                                            -xjc-XhashCode-hashCodeStrategyClass=com.evolveum.midpoint.util.xml.DomAwareHashCodeStrategy
                                        </extraarg> 
                                        <extraarg>-xjc-Xequals</extraarg>
                                         <extraarg>
                                            -xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
                                        </extraarg> -->
                                    </extraargs>
                                </wsdlOption>
                                
                                <wsdlOption>
                                    <wsdl>target/midpoint-schema/xml/ns/private/report/reportWrapper.wsdl</wsdl>
                                    <wsdlLocation>classpath:xml/ns/private/report/reportWrapper.wsdl</wsdlLocation>
                                    <catalog>${basedir}/src/compile/resources/jax-ws-catalog.xml</catalog>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-xjc-Xts</extraarg>
<!--                                        <extraarg>-xjc-XhashCode</extraarg>
                                        <extraarg>-xjc-Xequals</extraarg>
                                          <extraarg>
                                            -xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
                                        </extraarg>-->
                                    </extraargs>
                                </wsdlOption>
                                <wsdlOption>
                                    <!-- Ugly hack. The fake WSDL includes all the XSD files we need to compile
                                                  This is the only way I found to generate equals and hashCode methods with CXF.
                                                  If you find anything better please correct it. -->
                                    <wsdl>target/midpoint-schema/xml/ns/private/fake/fakeWrapper-report.wsdl</wsdl>
                                    <catalog>${basedir}/src/compile/resources/jax-ws-catalog.xml</catalog>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-xjc-Xts</extraarg>
<!--                                        <extraarg>-xjc-XhashCode</extraarg>
                                         <extraarg>
                                            -xjc-XhashCode-hashCodeStrategyClass=com.evolveum.midpoint.util.xml.DomAwareHashCodeStrategy
                                        </extraarg> 
                                        <extraarg>-xjc-Xequals</extraarg>
                                         <extraarg>
                                            -xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
                                        </extraarg> -->
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.cxf.xjcplugins</groupId>
                        <artifactId>cxf-xjc-ts</artifactId>
                        <version>${cxf-xjc.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>0.6.3</version>
                    </dependency>
                    <dependency>
                        <groupId>com.evolveum.midpoint.tools</groupId>
                        <artifactId>xjc-plugin</artifactId>
                        <version>3.2</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

