<?xml version="1.0" encoding="UTF-8"?>
<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>org.fcrepo</groupId>
    <artifactId>fcrepo</artifactId>
    <version>3.5</version>
  </parent>

  <artifactId>fcrepo-common</artifactId>
  <packaging>jar</packaging>
  <name>Fedora Common Library</name>

  <build>
    <plugins>

      <!-- Need to remove this plugin when ANT builds no longer supported -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*Test*</include>
          </includes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.3</version>

        <dependencies>
          <dependency>
            <groupId>axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.3</version>
          </dependency>
        </dependencies>

        <configuration>
          <sourceDirectory>${basedir}/../resources/wsdl</sourceDirectory>
          <testCases>false</testCases>
          <serverSide>true</serverSide>
          <skeletonDeploy>true</skeletonDeploy>
          <wrapArrays>false</wrapArrays>
          <useEmitter>true</useEmitter>
          <typeMappingVersion>1.2</typeMappingVersion>
        </configuration>

        <executions>
          <execution>
            <id>api-m</id>
            <goals>
              <goal>wsdl2java</goal>
            </goals>

            <configuration>
              <wsdlFiles>
                <wsdlFile>
                  Fedora-API-M.wsdl 
                </wsdlFile>
              </wsdlFiles>

              <mappings>
                <mapping>
                  <namespace>http://www.fedora.info/definitions/1/0/api/</namespace>
                  <targetPackage>org.fcrepo.server.management</targetPackage>
                </mapping>
                <mapping>
                  <namespace>http://www.fedora.info/definitions/1/0/auditing/</namespace>
                  <targetPackage>org.fcrepo.server.types.gen</targetPackage>
                </mapping>
                <mapping>
                  <namespace>http://www.fedora.info/definitions/1/0/binding/</namespace>
                  <targetPackage>org.fcrepo.server.types.gen</targetPackage>
                </mapping>
                <mapping>
                  <namespace>http://www.fedora.info/definitions/1/0/types/</namespace>
                  <targetPackage>org.fcrepo.server.types.gen</targetPackage>
                </mapping>
              </mappings>

            </configuration>

          </execution>
          <execution>
            <id>api-a</id>
            <goals>
              <goal>wsdl2java</goal>
            </goals>

            <configuration>
              <wsdlFiles>
                <wsdlFile>
                  Fedora-API-A.wsdl 
                </wsdlFile>
              </wsdlFiles>

              <mappings>
                <mapping>
                  <namespace>http://www.fedora.info/definitions/1/0/api/</namespace>
                  <targetPackage>org.fcrepo.server.access</targetPackage>
                </mapping>
                <mapping>
                  <namespace>http://www.fedora.info/definitions/1/0/types/</namespace>
                  <targetPackage>org.fcrepo.server.types.gen</targetPackage>
                </mapping>
              </mappings>

            </configuration>

          </execution>

        </executions>

      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <executions>
          <execution>
            <configuration>
              <excludeDefaultDirectories>true</excludeDefaultDirectories>
            </configuration>
            <id>wsdl-clean</id>
            <phase>process-classes</phase>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <filesets>
            <fileset>
              <directory>${project.build.directory}</directory>
              <includes>
                <include>**/FedoraAPIMBindingSOAPHTTPImpl*</include>
                <include>**/FedoraAPIMServiceLocator*</include>
                <include>**/FedoraAPIABindingSOAPHTTPImpl*</include>
                <include>**/FedoraAPIAServiceLocator*</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.1.1</version>
        <executions>

          <execution>
            <id>api-m</id>
            <phase>process-sources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.fcrepo.generate.BuildAxisStubWrapper</mainClass>
              <arguments>
                <argument>${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/management/FedoraAPIMBindingSOAPHTTPStub.java</argument>
                <argument>${project.build.sourceDirectory}/org/fcrepo/common/generate/FedoraStubWrapper.template</argument>
                <argument>org.fcrepo.client</argument>
                <argument>APIMStubWrapper</argument>
                <argument>${basedir}/../fcrepo-client/fcrepo-client-admin/stubwrappers/org/fcrepo/client/APIMStubWrapper.java</argument>
              </arguments>
            </configuration>
          </execution>

          <execution>
            <id>api-a</id>
            <phase>process-sources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.fcrepo.generate.BuildAxisStubWrapper</mainClass>
              <arguments>
                <argument>${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/access/FedoraAPIABindingSOAPHTTPStub.java</argument>
                <argument>${project.build.sourceDirectory}/org/fcrepo/common/generate/FedoraStubWrapper.template</argument>
                <argument>org.fcrepo.client</argument>
                <argument>APIAStubWrapper</argument>
                <argument>${basedir}/../fcrepo-client/fcrepo-client-admin/stubwrappers/org/fcrepo/client/APIAStubWrapper.java</argument>
              </arguments>
            </configuration>
          </execution>

        </executions>

      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>

          <execution>
            <id>clean-wsdl</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <forceCreation>true</forceCreation>
              <excludes>
                <exclude>**/FedoraAPIABindingSOAPHTTPImpl.class</exclude>
                <exclude>**/FedoraAPIMBindingSOAPHTTPImpl.class</exclude>
                <exclude>**/FedoraAPIAServiceLocator.class</exclude>
                <exclude>**/FedoraAPIMServiceLocator.class</exclude>
              </excludes>
            </configuration>
          </execution>

          <execution>
            <id>jar-tests</id>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>

        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>ant-replace-wsdd</id>
            <phase>process-classes</phase>
            <goals>
              <goal>run</goal>
            </goals>

            <configuration>
              <tasks>
                <replace
                  file="${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/management/deploy.wsdd"
                  token="Fedora-API-M-Port-SOAPHTTP" value="management" />
                <replace
                  file="${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/management/deploy.wsdd"
                  token="*&quot;/&gt;"
                  value="*&quot;/&gt;&lt;parameter name=&quot;scope&quot; value=&quot;application&quot;/&gt;" />
                <replace
                  file="${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/access/deploy.wsdd"
                  token="Fedora-API-A-Port-SOAPHTTP" value="access" />
                <replace
                  file="${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/management/undeploy.wsdd"
                  token="Fedora-API-M-Port-SOAPHTTP" value="management" />
                <replace
                  file="${project.build.directory}/generated-sources/axistools/wsdl2java/org/fcrepo/server/access/undeploy.wsdd"
                  token="Fedora-API-A-Port-SOAPHTTP" value="access" />
              </tasks>
            </configuration>

          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

  <dependencies>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>fcrepo-generate</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>commons-httpclient</groupId>
      <artifactId>commons-httpclient</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.xml</groupId>
      <artifactId>jaxrpc-api</artifactId>
      <version>1.1</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>axis</artifactId>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>mulgara-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>sunxacml</artifactId>
      <classifier>melcoe</classifier>
    </dependency>

    <dependency>
      <groupId>wsdl4j</groupId>
      <artifactId>wsdl4j</artifactId>
      <version>1.5.1</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    
    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>1.6.1</version>
    </dependency>
    
    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>saxon</artifactId>
      <version>9.0</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>

  </dependencies>
</project>
