<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2015 Red Hat Inc. and/or its affiliates and other contributors.
-
- 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>
    <parent>
        <groupId>org.switchyard.quickstarts.demos</groupId>
        <artifactId>switchyard-demo-cluster</artifactId>
        <version>2.0.1.redhat-621169</version>
    </parent>
    <artifactId>switchyard-demo-cluster-credit</artifactId>
    <packaging>bundle</packaging>
    <name>Quickstart Demo: Cluster - Credit Service</name>
    <description>Quickstart Demo: Cluster - Credit Service</description>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>
    <properties>
        <!-- Bundle symbolic name may not contain dashes -->
        <bundle.symbolic.name>${project.groupId}.switchyard.demo.cluster.credit</bundle.symbolic.name>
        <deploy.skip>true</deploy.skip>
        <wildfly.protocol>remote</wildfly.protocol>
        <wildfly.port.node2>10999</wildfly.port.node2>
        <wildfly.port.node3>11999</wildfly.port.node3>
        <switchyard.osgi.import>*</switchyard.osgi.import>
        <switchyard.osgi.require.capability>
           org.ops4j.pax.cdi.extension; filter:="(extension=switchyard-component-bean)",
           org.ops4j.pax.cdi.extension; filter:="(extension=deltaspike-core-api)",
           osgi.extender; filter:="(osgi.extender=pax.cdi)"
        </switchyard.osgi.require.capability>
        <switchyard.osgi.dynamic>
           org.switchyard,org.switchyard.*
        </switchyard.osgi.dynamic>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-transform</artifactId>
        </dependency>
        <dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-validate</artifactId>
        </dependency>
        <dependency>
            <groupId>org.switchyard</groupId>
            <artifactId>switchyard-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.switchyard.components</groupId>
            <artifactId>switchyard-component-test-mixin-cdi</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.switchyard.components</groupId>
            <artifactId>switchyard-component-sca</artifactId>
        </dependency>
        <dependency>
            <groupId>org.switchyard.components</groupId>
            <artifactId>switchyard-component-bean</artifactId>
        </dependency>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.switchyard</groupId>
                <artifactId>switchyard-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scannerClassNames>
                        <param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param>
                    </scannerClassNames>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${version.felix.maven}</version>
                <extensions>true</extensions>
                <configuration>
                    <excludeDependencies>false</excludeDependencies>
                    <instructions>
                        <Bundle-SymbolicName>${bundle.symbolic.name}</Bundle-SymbolicName>
                        <DynamicImport-Package>${switchyard.osgi.dynamic}</DynamicImport-Package>
                        <Embed-Dependency>!*</Embed-Dependency>
                        <Import-Package>${switchyard.osgi.import}</Import-Package>
                        <Include-Resource>{maven-resources}, META-INF/switchyard.xml=target/classes/META-INF/switchyard.xml</Include-Resource>
                        <Require-Capability>${switchyard.osgi.require.capability}</Require-Capability>
                    </instructions>
                    <archive>
                        <manifestEntries>
                            <Project-Artifact-Id>${project.artifactId}</Project-Artifact-Id>
                            <Project-Group-Id>${project.groupId}</Project-Group-Id>
                            <Project-Version>${project.version}</Project-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>${version.wildfly.maven}</version>
                <executions>
                    <execution>
                        <id>deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-only</goal>
                        </goals>
                        <configuration>
                            <port>${wildfly.port.node2}</port>
                            <filename>${project.build.finalName}.jar</filename>
                            <skip>${deploy.skip}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy2</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-only</goal>
                        </goals>
                        <configuration>
                            <port>${wildfly.port.node3}</port>
                            <filename>${project.build.finalName}.jar</filename>
                            <skip>${deploy.skip}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>undeploy</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>undeploy</goal>
                        </goals>
                        <configuration>
                            <port>${wildfly.port.node2}</port>
                            <filename>${project.build.finalName}.jar</filename>
                            <skip>${deploy.skip}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>undeploy2</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>undeploy</goal>
                        </goals>
                        <configuration>
                            <port>${wildfly.port.node3}</port>
                            <filename>${project.build.finalName}.jar</filename>
                            <skip>${deploy.skip}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <configuration>
                    <mainClass>dummy</mainClass>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>deploy</id>
            <properties>
                <deploy.skip>false</deploy.skip>
            </properties>
        </profile>
        <profile>
            <id>wildfly</id>
            <properties>
                <wildfly.protocol>http-remoting</wildfly.protocol>
                <wildfly.port.node2>10990</wildfly.port.node2>
                <wildfly.port.node3>11990</wildfly.port.node3>
            </properties>
        </profile>
    </profiles>
</project>
