<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>com.projectdarkstar.example.request</groupId>
    <artifactId>request</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <artifactId>request-server</artifactId>
  <name>Request Example Server</name>
  <packaging>jar</packaging>
  <description>
    Server module for the Project Darkstar request example.
  </description>

  <dependencies>
    <dependency>
      <groupId>com.projectdarkstar.server</groupId>
      <artifactId>sgs-server-api</artifactId>
    </dependency>
  </dependencies>

  <!-- The profiles below are used to launch the wanderer server with
       various different configurations.  For example, the default
       will use the sgs-maven-plugin to launch the wanderer server in single
       node mode using bdb :

       mvn verify -Prun-server

       There are also explicit profiles to specify the db type, and the node
       type that can be matched up:

       mvn verify -Prun-server,je,multi-node-server-core

       Additionally, the jvm.args, and jvm.args.extra properties can be
       overridden to send command line arguments to the resulting server:

       mvn verify -Prun-server -Djvm.args.extra="-Dcom.sun.sgs.app.name=NewName"

       When running multiple app nodes on the same machine, the jmx.port
       property must be different for each app node.  The listen.port must also
       be different:

       mvn verify -Prun-server,multi-node-server-app \
		  -Djmx.port=62975 -Dlisten.port=62965

       mvn verify -Prun-server,multi-node-server-app \
		  -Djmx.port=62976 -Dlisten.port=62966
       ...

       If you wish to use a new Project Darkstar installation, use
       -DcleanSgsHome=true.
    -->
  <profiles>

    <profile>
      <id>run-server</id>
      
      <build>
	<plugins>
	  
	  <plugin>
	    <groupId>com.projectdarkstar.maven.plugin</groupId>
	    <artifactId>sgs-maven-plugin</artifactId>
	    <version>1.0-beta-1</version>
	    <executions>
	      <execution>
		<id>sgs-run</id>
		<phase>integration-test</phase>
		<goals>
		  <goal>install</goal>
                  <goal>configure</goal>
                  <goal>deploy</goal>
		  <goal>boot</goal>
		</goals>
              </execution>
	    </executions>
	    <configuration>
	      <version>${sgs-server.version}</version>
	      <sgsHome>${project.build.directory}/sgs-server-dist-${sgs-server.version}</sgsHome>
              <sgsBoot>${project.build.directory}/test-classes/Request.boot</sgsBoot>
	      <sgsServer>${project.build.directory}/test-classes/${node.type}.properties</sgsServer>
	      <sgsLogging>${logging.properties}</sgsLogging>
              <cleanSgsHome>${cleanSgsHome}</cleanSgsHome>
	      <files>
		<file>${project.artifact.file}</file>
	      </files>
	    </configuration>
	  </plugin>
	  
	</plugins>
      </build>
    </profile>
    
    <profile>
      <id>db</id>
      <properties>
	<db.type>db</db.type>
      </properties>
    </profile>

    <profile>
      <id>je</id>
      <properties>
	<db.type>je</db.type>
      </properties>
    </profile>

    <profile>
      <id>single-node-server</id>
      <properties>
	<node.type>RequestSingle</node.type>
      </properties>
    </profile>

    <profile>
      <id>multi-node-server-core</id>
      <properties>
	<node.type>RequestCore</node.type>
	<jmx.port>62973</jmx.port>
	<listen.port>62963</listen.port>
      </properties>
    </profile>

    <profile>
      <id>multi-node-server-app</id>
      <properties>
	<node.type>RequestApp</node.type>
      </properties>
    </profile>

  </profiles>

  <build>

    <plugins>
      <!-- Use version 2.3 of the resources plugin 
	   to pickup a needed filtering bugfix -->
      <plugin>                
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.3</version>
      </plugin>

    </plugins>
    
    <!-- Enable filtering of the properties files -->
    <testResources>
      <testResource>
	<directory>src/test/properties</directory>
	<filtering>true</filtering>
      </testResource>
    </testResources>
  </build>

  <properties>
    <jvm.args>-Xmx1g</jvm.args>
    <jvm.args.extra></jvm.args.extra>
    <logging.properties>
      ${project.build.directory}/test-classes/logging.properties
    </logging.properties>
    <db.type>db</db.type>
    <node.type>RequestSingle</node.type>
    <jmx.port>62974</jmx.port>
    <listen.port>62964</listen.port>
    <cleanSgsHome>false</cleanSgsHome>
  </properties>

</project>
