<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF 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.
-->
<assembly>
    <id></id> <!-- intentionally left blank -> http://jira.codehaus.org/browse/MASSEMBLY-301 -->
    <formats>
        <format>jar</format>
        <format>tar.gz</format>
    </formats>
    <fileSets>

        <!-- Expanded ServiceMix Runtime -->
        <fileSet>
            <directory>target/dependencies/unix/apache-karaf-${karaf.version}</directory>
            <outputDirectory>/</outputDirectory>
            <excludes>
              <exclude>**/demos/**</exclude>
              <exclude>bin/**</exclude>
              <exclude>etc/system.properties</exclude>
              <exclude>etc/org.apache.karaf.features.cfg</exclude>
              <exclude>etc/org.apache.karaf.features.obr.cfg</exclude>
              <exclude>etc/org.ops4j.pax.logging.cfg</exclude>
              <exclude>etc/users.properties</exclude>
              <exclude>etc/custom.properties</exclude>
              <exclude>etc/jre.properties</exclude>
              <exclude>etc/startup.properties</exclude>
              <!-- SMX4-764 - Override Felix Framework version -->
              <!-- begin snippet -->
              <exclude>system/org/apache/felix/org.apache.felix.framework/**</exclude>
              <!-- end snippet -->
              <exclude>LICENSE</exclude>
              <exclude>NOTICE</exclude>
              <exclude>README</exclude>
              <exclude>RELEASE-NOTES</exclude>
              <exclude>karaf-manual*</exclude>
            </excludes>
        </fileSet>

        <!-- Copy over bin/* scripts separately to get the correct file mode -->
        <fileSet>
            <directory>target/dependencies/unix/apache-karaf-${karaf.version}</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
              <include>bin/*</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>

        <!-- Copy over karaf demo to examples folder -->
        <fileSet>
            <directory>target/dependencies/unix/apache-karaf-${karaf.version}/demos</directory>
            <outputDirectory>/examples/karaf-demos</outputDirectory>
            <lineEnding>unix</lineEnding>
            <includes>
              <include>pom.xml</include>
              <include>**/web/**</include>
            </includes>
        </fileSet>
       
       <!-- Copy over ant files -->
       <fileSet>
            <directory>target/dependencies/unix/apache-servicemix-nmr-${servicemix.nmr.version}/ant</directory>
            <outputDirectory>/ant</outputDirectory>
            <lineEnding>unix</lineEnding>
       </fileSet>

       <!-- Using the NMR's startup.properties because that has OBR support enabled by default -->
       <fileSet>
           <directory>target/dependencies/unix/apache-servicemix-nmr-${servicemix.nmr.version}/etc</directory>
           <outputDirectory>/etc</outputDirectory>
           <lineEnding>unix</lineEnding>
           <includes>
               <include>startup.properties</include>
           </includes>
       </fileSet>

       <!-- Copy over nmr examples files -->
       <fileSet>
            <directory>target/dependencies/unix/apache-servicemix-nmr-${servicemix.nmr.version}/examples</directory>
            <outputDirectory>/examples/</outputDirectory>
            <excludes>
                <exclude>pom.xml</exclude>
                <exclude>**/itests/**</exclude>
                <exclude>**/target/**</exclude>
                <exclude>**/.classpath</exclude>
                <exclude>**/.project</exclude>
                <exclude>**/.settings/**</exclude>
            </excludes>
            <lineEnding>unix</lineEnding>
       </fileSet>

        <!-- Copy license and other files from root -->
        <fileSet>
            <directory>${basedir}/..</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>README</include>
                <include>esb_*</include>
                <!-- <include>RELEASE*</include>  - exclude Apache RELEASE-NOTES file, cfr. ESB-1372 -->
            </includes>
            <lineEnding>unix</lineEnding>
            <fileMode>0644</fileMode>
        </fileSet>

        <!-- Copy over jar files -->
        <fileSet>
            <directory>target/dependencies</directory>
            <includes>
                <include>servicemix-version.jar</include>
            </includes>
            <outputDirectory>/lib/</outputDirectory>
        </fileSet>

        <!-- Copy over everything that needs to get unix line endings -->
        <fileSet>
            <directory>src/main/distribution/text</directory>
            <outputDirectory>/</outputDirectory>
            <lineEnding>unix</lineEnding>
            <fileMode>0644</fileMode>
        </fileSet>        
        <fileSet>
            <directory>target/classes/etc</directory>
            <outputDirectory>/etc/</outputDirectory>
            <lineEnding>unix</lineEnding>
            <fileMode>0644</fileMode>
        </fileSet>
       <fileSet>
            <directory>src/main/distribution/unix-shell</directory>
            <outputDirectory>/</outputDirectory>
            <lineEnding>unix</lineEnding>
            <fileMode>0755</fileMode>
        </fileSet>

        <!-- Copy over the examples -->
        <fileSet>
            <directory>${basedir}/../examples</directory>
            <outputDirectory>/examples/</outputDirectory>
            <lineEnding>unix</lineEnding>
            <excludes>
                <exclude>pom.xml</exclude>
                <!--we need add filtered README.txt, so exclude the raw one here-->
                <exclude>**/README.txt</exclude>
                <exclude>**/itests/**</exclude>
                <exclude>**/target/**</exclude>
                <exclude>**/.classpath</exclude>
                <exclude>**/.project</exclude>
                <exclude>**/.settings/**</exclude>
                <exclude>**/wsdl-first/**</exclude>
                <exclude>**/loan-broker-bpel/**</exclude>
                <exclude>**/web/**</exclude>
            </excludes>
        </fileSet>
        
        <fileSet>
          <directory>target/features-repo</directory>
          <outputDirectory>system</outputDirectory>
        </fileSet>

    </fileSets>

    <files>
        <file>
            <source>${basedir}/target/dependencies/unix/apache-karaf-${karaf.version}/bin/karaf</source>
            <outputDirectory>/bin/</outputDirectory>
            <destName>servicemix</destName>
            <fileMode>0755</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/target/dependencies/servicemix-version.jar</source>
            <outputDirectory>/lib/</outputDirectory>
            <fileMode>0644</fileMode>
        </file>
        <file>
            <source>${basedir}/target/classes/features.xml</source>
            <outputDirectory>system/org/apache/servicemix/${artifactId}/${version}</outputDirectory>
            <destName>${artifactId}-${version}-features.xml</destName>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>

        <file>
            <source>${basedir}/target/maven-shared-archive-resources/META-INF/LICENSE</source>
            <outputDirectory>/</outputDirectory>
            <destName>LICENSE</destName>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/target/maven-shared-archive-resources/META-INF/NOTICE</source>
            <outputDirectory>/</outputDirectory>
            <destName>NOTICE</destName>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>

        <!--filtering README.txt-->
        <file>
            <source>${basedir}/../examples/README.txt</source>
            <outputDirectory>/examples/</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/bridge/README.txt</source>
            <outputDirectory>/examples/bridge</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-ws-addressing/README.txt</source>
            <outputDirectory>/examples/cxf-ws-addressing</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-jaxrs/README.txt</source>
            <outputDirectory>/examples/cxf-jaxrs</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-wsdl-first-osgi-package/README.txt</source>
            <outputDirectory>/examples/cxf-wsdl-first-osgi-package</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/bridge-camel/README.txt</source>
            <outputDirectory>/examples/bridge-camel</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/camel/README.txt</source>
            <outputDirectory>/examples/camel</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/camel-blueprint/README.txt</source>
            <outputDirectory>/examples/camel-blueprint</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-wsdl-first/README.txt</source>
            <outputDirectory>/examples/cxf-wsdl-first</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/camel-osgi/README.txt</source>
            <outputDirectory>/examples/camel-osgi</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/camel-nmr/README.txt</source>
            <outputDirectory>/examples/camel-nmr</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
          <source>${basedir}/../examples/camel-nmr-blueprint/README.txt</source>
          <outputDirectory>/examples/camel-nmr-blueprint</outputDirectory>
          <filtered>true</filtered>
          <fileMode>0644</fileMode>
          <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-nmr/README.txt</source>
            <outputDirectory>/examples/cxf-nmr</outputDirectory>               
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-osgi/README.txt</source>
            <outputDirectory>/examples/cxf-osgi</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-ws-security-osgi/README.txt</source>
            <outputDirectory>/examples/cxf-ws-security-osgi</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-ws-rm/README.txt</source>
            <outputDirectory>/examples/cxf-ws-rm</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/jpa-osgi/README.txt</source>
            <outputDirectory>/examples/jpa-osgi</outputDirectory>
            <filtered>true</filtered>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/cxf-camel-nmr/README.txt</source>
            <outputDirectory>/examples/cxf-camel-nmr</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/../examples/simple/README.txt</source>
            <outputDirectory>/examples/simple</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
        <file>
            <source>${basedir}/target/classes/pom.xml</source>
            <outputDirectory>/examples/</outputDirectory>
            <filtered>true</filtered>
            <fileMode>0644</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
    </files>

    <dependencySets>
        <dependencySet>
            <outputDirectory>/lib/endorsed</outputDirectory>
            <includes>
                <include>org.apache.xerces:xercesImpl</include>
                <include>org.apache.xerces:xml-apis</include>
                <include>xalan:xalan</include>
                <include>xalan:serializer</include>
            </includes>
        </dependencySet>
        <dependencySet>
            <outputDirectory>/system</outputDirectory>
            <unpack>false</unpack>
            <useProjectArtifact>false</useProjectArtifact>
            <outputFileNameMapping>org/apache/felix/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
            <includes>
                <include>org.apache.felix:org.osgi.compendium</include>
            </includes>
        </dependencySet>
        <!-- SMX4-764 - Override Felix Framework to 3.0.8 version -->
        <!-- begin snippet -->
        <dependencySet>
            <outputDirectory>/system</outputDirectory>
            <unpack>false</unpack>
            <useProjectArtifact>false</useProjectArtifact>
            <outputFileNameMapping>org/apache/felix/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
            <includes>
                <include>org.apache.felix:org.apache.felix.framework</include>
            </includes>
        </dependencySet>
        <!-- end snippet -->

        <dependencySet>
            <outputDirectory>/system</outputDirectory>
            <unpack>false</unpack>
            <useProjectArtifact>false</useProjectArtifact>
            <outputFileNameMapping>hsqldb/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
            <includes>
                <include>hsqldb:hsqldb</include>
            </includes>
        </dependencySet>

    </dependencySets>

</assembly>
