<project name="Nova Orchestra install" basedir=".">
  <description>Install Nova Orchestra.</description>

  <import file="build.xml" />
  <property file="conf/orchestra.properties" />
  <property file="conf/install.properties" />
	<property name="resources.dir" location="${basedir}/resources"/>

  <available file="${catalina.base}/webapps/${orchestra.servlet.path}" type="dir" property="orchestra.dir.present" />
  
  <target name="install" description="Install orchestra in tomcat">
    <fail if="orchestra.dir.present">ERROR: Orchestra webapp dir exists. Please remove ${catalina.base}/webapps/${orchestra.servlet.path} directory and restart installation.</fail>
    <antcall target="install-no-fail" />
  </target>
  
  <target name="install-no-fail" description="Install orchestra in tomcat if not already installed" unless="orchestra.dir.present">
    <mkdir dir="${catalina.home}/conf" />
    <mkdir dir="${catalina.home}/webapps" />
    <unwar dest="${catalina.base}/webapps/${orchestra.servlet.path}">
      <fileset dir="${basedir}/lib">
        <include name="**/orchestra-*.war"/>
      </fileset>
      <patternset>
        <exclude name="WEB-INF/classes/*.xml"/>
        <exclude name="WEB-INF/classes/*.properties"/>
      </patternset>
    </unwar>
    <unwar dest="${catalina.base}/webapps/console">
       <fileset dir="${basedir}/lib">
         <include name="**/console-*.war"/>
       </fileset>
       <patternset>
         <exclude name="WEB-INF/classes/*.xml"/>
         <exclude name="WEB-INF/classes/*.properties"/>
       </patternset>
    </unwar>
    <echo message="############################################################################################"/>
    <echo message="Installation and configuration finished."/>
    <echo message="Default configuration has been used."/>
    <echo message="    -> see conf/orchestra.properties."/>
  	<echo message=""/>
  	<echo message="!!! WARNING !!!"/>
    <echo message="If you need to configure a proxy, specify proxy options in the JAVA_OPTS environment variable"/> 
    <echo message="(see http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html for information)."/>
    <echo message="############################################################################################"/>
  </target>
	

</project>




