<?xml version="1.0" encoding="UTF-8"?>
<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. 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.
 -->
<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">

    <parent>
        <groupId>org.wso2.carbon.business-process</groupId>
        <artifactId>bpel</artifactId>
        <version>4.4.100</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.bpel.b4p</artifactId>
    <packaging>bundle</packaging>
    <name>WSO2 Carbon - BPEL BPEL4People Extension</name>
    <description>BPEL Extension for BPEL4People (Human Interactions)</description>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.bpel</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.bpel.skeleton</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.bpel.common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.org.apache.ode</groupId>
            <artifactId>ode</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.security.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.ndatasource.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans.wso2</groupId>
            <artifactId>xmlbeans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database.wso2</groupId>
            <artifactId>h2-database-engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jpa_2.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.registry</groupId>
            <artifactId>org.wso2.carbon.registry.extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.securevault</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Coordination configuration xml beans generation  -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xmlbeans-maven-plugin</artifactId>
                <version>2.3.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>xmlbeans</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>src/main/resources/schemas</schemaDirectory>
                    <xmlConfigs>
                        <xmlConfig implementation="java.io.File">
                            src/main/resources/schemas/xmlbeans.conf
                        </xmlConfig>
                    </xmlConfigs>
                    <noUpa>false</noUpa>
                    <sourceGenerationDirectory>
                        target/generated-code/src
                    </sourceGenerationDirectory>
                </configuration>
            </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>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>create-b4p-database</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <path id="h2.classpath">
                                    <path refid="maven.compile.classpath" />
                                </path>

                                <echo message="########### Create B4P Coordination Database ##############" />
                                <sql driver="org.h2.Driver" url="jdbc:h2:${basedir}/target/database/b4ph2db;create=true" userid="sa" password="" autocommit="true" onerror="continue">
                                    <classpath>
                                        <path refid="h2.classpath" />
                                    </classpath>
                                    <fileset file="${basedir}/target/h2.sql" />
                                </sql>
                                <echo message="##################### END ############################" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>openjpa-enhancer</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="maven.runtime.classpath" refid="maven.compile.classpath" />
                                <path id="classpath">
                                    <pathelement path="${maven.runtime.classpath}" />
                                </path>
                                <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="classpath" />
                                <openjpac>
                                    <fileset dir="${basedir}/src/main">
                                        <include name="**/dao/jpa/openjpa/entity/*.java" />
                                        <!--<include name="**/*.java" />-->
                                    </fileset>
                                    <classpath>
                                        <pathelement location="${basedir}/target/classes" />
                                        <pathelement path="${maven.runtime.classpath}" />
                                    </classpath>
                                </openjpac>
                            </tasks>
                        </configuration>
                    </execution>
                    <!--execution>
                        <id>xcreate-db-schemas</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="maven.runtime.classpath" refid="maven.compile.classpath" />
                                <path id="classpath">
                                    <pathelement path="${maven.runtime.classpath}" />
                                </path>

                                <taskdef name="mappingtool" classname="org.apache.openjpa.jdbc.ant.MappingToolTask" classpathref="classpath" />

                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/derby.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.derby.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/h2.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.h2.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>

                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/mysql.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.mysql.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/oracle.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.oracle.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/postgres.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.postgres.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/sqlserver.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.sqlserver.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
  				<mappingtool schemaAction="build" sqlFile="${basedir}/target/db2.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.db2.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                            </tasks>
                        </configuration>
                    </execution-->
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Private-Package>
                            org.wso2.carbon.bpel.b4p.internal
                        </Private-Package>
                        <Export-Package>
                            !org.wso2.carbon.bpel.b4p.internal,
                            org.wso2.carbon.bpel.b4p.*;
                            version="${carbon.business-process.exp.pkg.version}"
                        </Export-Package>
                        <Import-Package>
                            !org.wso2.carbon.bpel.b4p.*,
                            org.wso2.carbon.bpel.core.*,
                            org.apache.ode.*,
                            org.apache.axis2.*; version="${axis2.osgi.version.range.bpel}",
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <mavan.findbugsplugin.exclude.file>${basedir}/src/main/resources/FindBug-Exclude.xml</mavan.findbugsplugin.exclude.file>
    </properties>

</project>
