<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">

    <parent>
        <groupId>org.wso2.carbon</groupId>
        <artifactId>bpel-parent</artifactId>
        <version>2.0.2</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.bpel.ode.integration</artifactId>
    <packaging>bundle</packaging>
    <name>ode.integration</name>
    <url>http://wso2.org</url>
    <description>ODE-Axis2 Integration Layer</description>


    <dependencies>

        <dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb-codegen</artifactId>
            <version>${axis2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
            <version>${wso2carbon.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-commons</artifactId>
            <version>1.3.0.wso2v3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ode.wso2</groupId>
            <artifactId>ode</artifactId>
            <version>2.1.0.wso2v1</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <inherited>false</inherited>
                <configuration>
                    <forkMode>pertest</forkMode>
                    <argLine>-enableassertions</argLine>
                    <testFailureIgnore>false</testFailureIgnore>
                    <systemproperties>
                        <property>              <!-- Specific log4j config for tests -->
                            <name>log4j.configuration</name>
                            <value>file:test-log4j.properties</value>
                        </property>
                    </systemproperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>source-code-generation</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                    <arg line="-uri src/main/resources/wsdls/process_management.wsdl -uw -ss -sd
                                    -o target/generated-code -p org.wso2.carbon.bpel.ode.integration.management
                                    -ns2p http://wso2.org/bps/management/schema=org.wso2.carbon.bpel.ode.integration.management.types,http://wso2.org/bps/management/wsdl/ProcessManagement=org.wso2.carbon.bpel.ode.integration.management"/>
                                    <classpath refid="maven.dependency.classpath"/>
                                    <classpath refid="maven.compile.classpath"/>
                                    <classpath refid="maven.runtime.classpath"/>
                                </java>
                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                    <arg line="-uri src/main/resources/wsdls/instance_management.wsdl -uw -ss -sd
                                    -o target/generated-code -p org.wso2.carbon.bpel.ode.integration.management
                                    -ns2p http://wso2.org/bps/management/schema=org.wso2.carbon.bpel.ode.integration.management.types,http://wso2.org/bps/management/wsdl/InstanceManagement=org.wso2.carbon.bpel.ode.integration.management"/>
                                    <classpath refid="maven.dependency.classpath"/>
                                    <classpath refid="maven.compile.classpath"/>
                                    <classpath refid="maven.runtime.classpath"/>
                                </java>
                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                    <arg line="-uri src/main/resources/wsdls/bpelpackage_management.wsdl -uw -ss -sd
                                    -o target/generated-code -p org.wso2.carbon.bpel.ode.integration.management
                                    -ns2p http://wso2.org/bps/management/schema=org.wso2.carbon.bpel.ode.integration.management.types,http://wso2.org/bps/management/wsdl/BPELPackageManagement=org.wso2.carbon.bpel.ode.integration.management"/>
                                    <classpath refid="maven.dependency.classpath"/>
                                    <classpath refid="maven.compile.classpath"/>
                                    <classpath refid="maven.runtime.classpath"/>
                                </java>
                                <delete file="target/generated-code/src/org/wso2/carbon/bpel/ode/integration/management/ProcessManagementServiceSkeleton.java"
                                        verbose="true" failonerror="true"/>
                                <delete file="target/generated-code/src/org/wso2/carbon/bpel/ode/integration/management/InstanceManagementServiceSkeleton.java"
                                        verbose="true" failonerror="true"/>
                                <delete file="target/generated-code/src/org/wso2/carbon/bpel/ode/integration/management/BPELPackageManagementServiceSkeleton.java"
                                        verbose="true" failonerror="true"/>
                                <copy file="target/generated-code/resources/bps_management.xsd"
                                      tofile="src/main/resources/META-INF/bps_management.xsd" verbose="true"
                                      overwrite="true"/>
                                <copy file="target/generated-code/resources/ProcessManagementService.wsdl"
                                      tofile="src/main/resources/META-INF/ProcessManagementService.wsdl" verbose="true"
                                      overwrite="true"/>
                                <copy file="target/generated-code/resources/ProcessManagementService.wsdl"
                                      tofile="src/main/resources/META-INF/InstanceManagementService.wsdl" verbose="true"
                                      overwrite="true"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-code/src</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
                        <Export-Package>
                            org.wso2.carbon.bpel.ode.integration.*
                        </Export-Package>
                        <Import-Package>
                            !org.wso2.carbon.bpel.ode.integration,
                            !org.wso2.carbon.bpel.ode.integration.store,
                            org.apache.ode.*,
                            org.apache.axis2.*; version="${axis2.osgi.version.range}",
                            javax.servlet;version=2.4.0,
                            javax.servlet.http;version=2.4.0,
                            javax.transaction.*,
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <properties>
        <opencsv.version>1.8</opencsv.version>
        <commons.dbcp.version>1.2.2</commons.dbcp.version>
        <commons.pool.version>1.3</commons.pool.version>
        <ode.version>1.2.0.wso2-r30912</ode.version>
        <synapse.version>1.3.0.wso2v3</synapse.version>
        <axis2.osgi.version>1.4.1.wso2</axis2.osgi.version>
    </properties>

</project>
