<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>

  <!-- Inherit from the global SGS super POM -->
  <parent>
    <groupId>com.projectdarkstar</groupId>
    <artifactId>sgs</artifactId>
    <version>15</version>
  </parent>

  <groupId>com.projectdarkstar.server</groupId>
  <artifactId>sgs-server-parent</artifactId>
  <name>Project Darkstar Server Parent POM</name>
  <packaging>pom</packaging>
  <version>0.9.10.6</version>
  <inceptionYear>2007</inceptionYear>
  <url>http://www.projectdarkstar.com</url>
  <scm>
    <connection>
      scm:svn:https://sgs-server.dev.java.net/svn/sgs-server/trunk
    </connection>
    <developerConnection>
      scm:svn:https://sgs-server.dev.java.net/svn/sgs-server/trunk
    </developerConnection>
    <url>
      https://sgs-server.dev.java.net/source/browse/sgs-server/trunk
    </url>
  </scm>
  <description>
    Parent POM of the Project Darkstar Server
  </description>

  <!-- Require at least Maven version 2.0.9 to build -->
  <prerequisites>
    <maven>2.0.9</maven>
  </prerequisites>

  <modules>
    <module>sgs-boot</module>
    <module>sgs-stop</module>
    <module>sgs-server</module>
    <module>sgs-server-api</module>
    <module>sgs-server-dist</module>
    <module>sgs-server-javadoc</module>
    <module>sgs-server-internal-api</module>
    <module>sgs-tutorial-server</module>
    <module>sgs-tutorial-server-dist</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
	
	<!-- The resource bundle executions should be activated in modules
	     that produce jars that require the license to be bundled
	     in the jar -->
	<plugin>
	  <groupId>org.apache.maven.plugins</groupId>
	  <artifactId>maven-remote-resources-plugin</artifactId>
	  <configuration>
	    <properties>
	      <projectName>Project Darkstar Server</projectName>
	    </properties>
	  </configuration>
	</plugin>

	<!-- The license plugin should be activated in modules that
	     contain source code and thus need to verify correct license
	     headers in each source code file -->
	<plugin>
	  <groupId>com.google.code.maven-license-plugin</groupId>
          <artifactId>maven-license-plugin</artifactId>
	  <executions>
	    <execution>
	      <id>check-notice</id>
	      <phase>package</phase>
	    </execution>
	  </executions>
	</plugin>

	<!-- The berkeleydb binary package must be retrieved and unpacked
	     Before the test phase so that they are available during
	     runtime of the unit tests.
	     To enable this dependency unpack, activate the unpack-bdb-binaries
	     execution id in the child POM -->
	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>unpack-bdb-binaries</id>
              <goals>
		<goal>unpack</goal>
              </goals>
              <configuration>
		<artifactItems>
                  <artifactItem>
                    <groupId>com.projectdarkstar.ext.berkeleydb</groupId>
                    <artifactId>db-binaries</artifactId>
		    <type>zip</type>
                    <overWrite>false</overWrite>
                    <outputDirectory>
		      ${project.build.directory}/
		    </outputDirectory>
                  </artifactItem>
		</artifactItems>
              </configuration>
            </execution>
          </executions>
	</plugin>

	
      </plugins>
    </pluginManagement>

    <plugins>

      <!-- Use 1.6 for source and target for the server code -->
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
	  <source>1.6</source>
	  <target>1.6</target>
	</configuration>
      </plugin>
    </plugins>
  </build>

  <dependencyManagement>
    <dependencies>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-client</artifactId>
	<version>${sgs-client.version}</version>
	<scope>test</scope>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-shared</artifactId>
	<version>${sgs-shared.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-shared</artifactId>
	<classifier>sources</classifier>
	<version>${sgs-shared.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-boot</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-stop</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-api</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-api</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-internal-api</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-internal-api</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-javadoc</artifactId>
	<classifier>api</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-tutorial-server</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-tutorial-server</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-tutorial-server-dist</artifactId>
	<type>zip</type>
	<version>${sgs.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	<artifactId>db</artifactId>
	<version>${bdb.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	<artifactId>db-binaries</artifactId>
	<version>${bdb.version}</version>
	<type>zip</type>
      </dependency>
      <dependency>
	<groupId>com.sleepycat</groupId>
	<artifactId>je</artifactId>
	<version>${bdb.je.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.tools.test</groupId>
	<artifactId>sgs-test-ext</artifactId>
	<scope>test</scope>
	<version>${sgs-test-ext.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <!-- Profiles activated based on platform to set BDB properties
       The profile that is activated sets the bdb.lib.dir property 
       to the directory name of the bdb libraries in the bdb
       binary package for the platform in use. -->
  <profiles>
    <profile>
      <id>macosx-ppc</id>
      <properties>
	<bdb.lib.dir>macosx-ppc</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>mac</family>
	  <arch>ppc</arch>
	</os>
      </activation>
    </profile>

    <profile>
      <id>macosx-x86</id>
      <properties>
	<bdb.lib.dir>macosx-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>mac</family>
	  <arch>i386</arch>
	</os>
      </activation>
    </profile>

    <profile>
      <id>macosx-x86_64</id>
      <properties>
	<bdb.lib.dir>macosx-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>mac</family>
	  <arch>x86_64</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>solaris-x86</id>
      <properties>
	<bdb.lib.dir>solaris-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>SunOS</name>
	  <arch>x86</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>solaris-sparc</id>
      <properties>
	<bdb.lib.dir>solaris-sparc</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>SunOS</name>
	  <arch>sparc</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>linux-x86</id>
      <properties>
	<bdb.lib.dir>linux-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>Linux</name>
	  <arch>i386</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>linux-x86_64</id>
      <properties>
	<bdb.lib.dir>linux-x86_64</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>Linux</name>
	  <arch>x86_64</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>win32-x86</id>
      <properties>
	<bdb.lib.dir>win32-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>windows</family>
	</os>
      </activation>
    </profile>

    <!-- profile enabled to test with BDB Java edition.
	 This will set the run.bdb.env property to the BDB Java edition
	 class rather than the native class.  It will also
	 blank out the run.javapath and ensure that the BDB Java
	 edition dependency is declared BEFORE the BDB native edition
	 dependency.  The reason for this is so that we can ensure
	 that BDB Java edition appears first on the classpath to avoid
	 incompatible classes available in both editions. -->
    <profile>
      <id>bdb-java</id>
      <properties>
	<run.bdb.env>
	  com.sun.sgs.impl.service.data.store.db.je.JeEnvironment
	</run.bdb.env>
	<run.javapath></run.javapath>	  
      </properties>
      <dependencies>
	<dependency>
	  <groupId>com.sleepycat</groupId>
	  <artifactId>je</artifactId>
	</dependency>
	<dependency>
	  <groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	  <artifactId>db</artifactId>
	</dependency>
      </dependencies>
    </profile>

 
    <!-- profile enabled to test with BDB native edition.
	 This will set the run.bdb.env property to the BDB native
	 class rather than the Java edition class.  It will also
	 set the run.javapath to the appropriate native library
	 location and ensure that the BDB native edition dependency
	 is declared BEFORE the BDB Java edition dependency.
	 The reason for this is so that we can ensure
	 that BDB native edition appears first on the classpath to avoid
	 incompatible classes available in both editions. -->
    <profile>
      <id>bdb</id>
      <properties>
	<run.bdb.env>
	  com.sun.sgs.impl.service.data.store.db.bdb.BdbEnvironment
	</run.bdb.env>
	<run.javapath>
	  target/bdb-${bdb.version}/${bdb.lib.dir}/
	</run.javapath>	  
      </properties>
      <dependencies>
	<dependency>
	  <groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	  <artifactId>db</artifactId>
	</dependency>
	<dependency>
	  <groupId>com.sleepycat</groupId>
	  <artifactId>je</artifactId>
	</dependency>
      </dependencies>
    </profile>
    
  </profiles>

  <repositories>
    <repository>
      <id>java.net</id>
      <name>java.net Maven2 Repository</name>
      <url>http://download.java.net/maven/2/</url>
      <layout>default</layout>
    </repository>
  </repositories>

  <properties>
    <sgs.version>${version}</sgs.version>
    <sgs-shared.version>1.8</sgs-shared.version>
    <sgs-client.version>0.9.10</sgs-client.version>
    <bdb.version>4.5.20</bdb.version>
    <bdb.je.version>3.3.75</bdb.je.version>
    <sgs-test-ext.version>1.0</sgs-test-ext.version>

    <run.javapath>target/bdb-${bdb.version}/${bdb.lib.dir}/</run.javapath>
    <run.bdb.env>
      com.sun.sgs.impl.service.data.store.db.bdb.BdbEnvironment
    </run.bdb.env>
  </properties>

</project>
