Skip to main content

Source code file content

Revision: 57029

GLASSFISH-18987 Remove call to getService in critical path
» Project Revision History

» Checkout URL

svn / branches / v2_3.1.1 / bootstrap / setup.xml

Size: 43398 bytes, 1 line
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
 Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
 The contents of this file are subject to the terms of either the GNU
 General Public License Version 2 only ("GPL") or the Common Development
 and Distribution License("CDDL") (collectively, the "License").  You
 may not use this file except in compliance with the License. You can obtain
 a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 language governing permissions and limitations under the License.
 
 When distributing the software, include this License Header Notice in each
 file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 Sun designates this particular file as subject to the "Classpath" exception
 as provided by Sun in the GPL Version 2 section of the License file that
 accompanied this code.  If applicable, add the following below the License
 Header, with the fields enclosed by brackets [] replaced by your own
 identifying information: "Portions Copyrighted [year]
 [name of copyright owner]"
 
 Contributor(s):
 
 If you wish your version of this file to be governed by only the CDDL or
 only the GPL Version 2, indicate your decision by adding "[Contributor]
 elects to include this software in this distribution under the [CDDL or GPL
 Version 2] license."  If you don't indicate a single choice of license, a
 recipient has the option to distribute your version of this file under
 either the CDDL, the GPL Version 2 or to extend the choice of license to
 its licensees as provided above.  However, if you add GPL Version 2 code
 and therefore, elected the GPL Version 2 license, then the option applies
 only if the new code is made subject to such option by the copyright
 holder.
-->

<!-- THIS FILE SHIPS WITH THE RI BUNDLE TO SET UP THE SERVER -->

<project name="Top Level Build" default="all" basedir=".">

<property file="${basedir}/build.properties"/>
<property file="${basedir}/../input.properties"/>
<property name="install.home" value="${basedir}"/>

<property name="domain.name" value="domain1"/>
<property name="instance.name" value="server"/>
<property name="admin.user" value="admin"/>
<property name="admin.password" value="adminadmin"/>
<property name="admin.port" value="4848"/>
<property name="instance.port" value="8080"/>
<property name="orb.port" value="3700"/>
<property name="imq.port" value="7676"/>
<property name="https.port" value="8181"/>
<property name="glassfish.license" value="LICENSE.txt"/>
<property name="glassfish.zipfile" value="../glassfish-image-pe.zip"/>
<property name="glassfish.release.name" value="glassfish"/>
<property name="glassfish_pe.release.name" value="glassfish-pe"/>
<property name="glassfish.class" value="glassfish.class"/>
<property name="persistence-location" value="${install.home}/../glassfish-persistence"/>
<property name="glassfish-persistence.zipfile" value="glassfish-persistence-image.zip"/>
<property name="glassfish_persistence.class" value="glassfish_persistence.class"/>

<property name="jarpack-task.jar" value="${install.home}/lib/Pack200Task.jar"/>

<property name="adminpassfile" value="${install.home}/passfile"/>
<property name="asadmin.prefs.file" value="${install.home}/config/asadminenv.conf"/>
<property name="asadmin.default.profile" value="developer"/>
<property name="asadmin.default.secure" value="false"/>

<target name="setup.init" depends="get.java.home" description="Set up the OS version">
    <tstamp>
      <format property="start.time" pattern="MM/dd/yyyy hh:mm aa"/>
    </tstamp>
    <condition property="windows">
        <os family="windows" />
    </condition>
    <condition property="unix">
        <os family="unix" />
    </condition>
    <condition property="solaris">
        <equals arg1="${os.name}" arg2="SunOS"/>
    </condition>
    <condition property="solaris-sparc">
        <os name="SunOS" arch="sparc"/>
    </condition>
    <condition property="solaris-x86">
        <os name="SunOS" arch="x86"/>
    </condition>
    <condition property="linux">
        <equals arg1="${os.name}" arg2="Linux"/>
    </condition>
    <condition property="darwin">
        <os name="Mac OS X"/>
    </condition>
    <echo file="${adminpassfile}" append="false">AS_ADMIN_ADMINPASSWORD=${admin.password}</echo>
    <available file="${install.home}/lib/javaee.jar.pack.gz" property="run-jarunpack"/>
</target>

<target name="set.env" depends="set.env.win,set.env.unix"/>

<target name="set.env.win" depends="setup.init" if="windows">
    <property name="ASADMIN" value="${install.home}/bin/asadmin.bat"/>
</target>

<target name="set.env.unix" depends="setup.init" if="unix">
    <property name="ASADMIN" value="${install.home}/bin/asadmin"/>
</target>

<target name="get.java.home">
     <condition property="suffix" value="/..">
        <and>
            <os family="unix"/>
            <not>
                <os name="Mac OS X"/>
            </not>
        </and>
     </condition>
     <condition property="suffix" value="">
        <os name="Mac OS X"/> 
     </condition>
     <condition property="suffix" value="/..">
        <os family="windows"/> 
     </condition>
    <!-- setup the local.java.home -->
    <property name="local.java.home" value="${java.home}${suffix}"/>
</target>

<target name="validate-java" depends="setup.init" unless="darwin">
    <echo message="Current Java Version ${java.version}"/>
    <available file="${local.java.home}${file.separator}lib${file.separator}tools.jar" property="jdk.present"/>
    <fail message="Please set java.home to a JDK installation" unless="jdk.present"/> 
</target>

<target name="check-java" depends="setup.init">
    <antcall target="validate-java"/>
    <exec executable="${local.java.home}${file.separator}bin${file.separator}java" outputProperty="targeted.java.version">
       <arg line="-version"/>
    </exec>
    <condition property="java.version.acceptable">
       <or>
         <contains string="${targeted.java.version}" substring="1.5"/>
         <contains string="${targeted.java.version}" substring="1.6"/>
       </or>
    </condition>
    <fail message="Glassfish requires JDK 1.5 or higher, you have ${targeted.java.version}"  unless="java.version.acceptable"/>
</target> 

<target name="setup" depends="all"/>

<target name="all" description="Installer the server">

    <!-- ===============  COPY ===================  -->
    <mkdir dir="${install.home}/bin"/>

    <antcall target="check-java"/>

    <antcall target="glassfish-jarunpack"/>

    <antcall target="do.copy"/>

    <!-- ============= TOKEN REPLACEMENT ===================  -->
    <antcall target="do.token"/>

    <!-- ============= CHMOD ===================  -->
    <antcall target="do.chmod"/>

    <!-- ============= CREATE DEFAULT DOMAIN ===================  -->
    <antcall target="create.domain"/>

</target>

<target name="do.copy" 
        depends="-do.copy.common, do.copy.windows, do.copy.unix"/>

<target name="-do.copy.common" depends="setup.init">
    <copy file="${install.home}/lib/install/templates/asadminenv.conf" 
          tofile="${asadmin.prefs.file}"/>
</target>

<target name="do.copy.windows" depends="setup.init" if="windows">
    <!-- copy to:: config -->
    <copy file="${install.home}/lib/install/templates/asenv.bat.template" 
          tofile="${install.home}/config/asenv.bat"/>

    <!-- copy to:: bin -->
    <copy file="${install.home}/lib/cliutil.dll" 
          tofile="${install.home}/bin/cliutil.dll"/>
    <copy file="${install.home}/lib/install/templates/asadmin.bat.template" 
          tofile="${install.home}/bin/asadmin.bat"/>
    <copy file="${install.home}/lib/install/templates/asant.bat.template" 
          tofile="${install.home}/bin/asant.bat"/>
    <copy file="${install.home}/lib/install/templates/appclient.bat.template" 
          tofile="${install.home}/bin/appclient.bat"/>
    <copy file="${install.home}/lib/install/templates/jspc.bat.template" 
          tofile="${install.home}/bin/jspc.bat"/>
    <copy file="${install.home}/lib/install/templates/package-appclient.bat.template" 
          tofile="${install.home}/bin/package-appclient.bat"/>
    <copy file="${install.home}/lib/install/templates/verifier.bat.template" 
          tofile="${install.home}/bin/verifier.bat"/>
    <copy file="${install.home}/lib/install/templates/asupgrade.bat.template" 
          tofile="${install.home}/bin/asupgrade.bat"/>
    <copy file="${install.home}/lib/install/templates/capture-schema.bat.template" 
          tofile="${install.home}/bin/capture-schema.bat"/>
    <copy file="${install.home}/lib/install/templates/wsimport.bat.template"
          tofile="${install.home}/bin/wsimport.bat"/>
    <copy file="${install.home}/lib/install/templates/wsgen.bat.template"
          tofile="${install.home}/bin/wsgen.bat"/>
    <copy file="${install.home}/lib/install/templates/schemagen.bat.template"
          tofile="${install.home}/bin/schemagen.bat"/>
    <copy file="${install.home}/lib/install/templates/xjc.bat.template"
          tofile="${install.home}/bin/xjc.bat"/>
    <copy file="${install.home}/lib/install/templates/asapt.bat.template"
          tofile="${install.home}/bin/asapt.bat"/>
    <copy file="${install.home}/lib/install/templates/wscompile.bat.template"
          tofile="${install.home}/bin/wscompile.bat"/>
    <copy file="${install.home}/lib/install/templates/wsdeploy.bat.template"
          tofile="${install.home}/bin/wsdeploy.bat"/>
    <copy file="${install.home}/updatecenter/lib/install/templates/updatetool.bat.template"
          tofile="${install.home}/updatecenter/bin/updatetool.bat"/>      
</target>

<target name="do.copy.unix" depends="setup.init" if="unix">
    <!-- copy to:: config -->
    <copy file="${install.home}/lib/install/templates/asenv.conf.template" 
          tofile="${install.home}/config/asenv.conf"/>

    <!-- copy to:: bin -->
    <copy file="${install.home}/lib/install/templates/uninstall.template" 
          tofile="${install.home}/bin/uninstall"/>
    <copy file="${install.home}/lib/install/templates/asadmin.template" 
          tofile="${install.home}/bin/asadmin"/>
    <copy file="${install.home}/lib/install/templates/asant.template" 
          tofile="${install.home}/bin/asant"/>
    <copy file="${install.home}/lib/install/templates/appclient.template" 
          tofile="${install.home}/bin/appclient"/>
    <copy file="${install.home}/lib/install/templates/jspc.template" 
          tofile="${install.home}/bin/jspc"/>
    <copy file="${install.home}/lib/install/templates/package-appclient.template" 
          tofile="${install.home}/bin/package-appclient"/>
    <copy file="${install.home}/lib/install/templates/verifier.template" 
          tofile="${install.home}/bin/verifier"/>
    <copy file="${install.home}/lib/install/templates/asupgrade.template" 
          tofile="${install.home}/bin/asupgrade"/>
    <copy file="${install.home}/lib/install/templates/capture-schema.template"
          tofile="${install.home}/bin/capture-schema"/>
    <copy file="${install.home}/lib/install/templates/wsimport.template"
          tofile="${install.home}/bin/wsimport"/>
    <copy file="${install.home}/lib/install/templates/wsgen.template"
          tofile="${install.home}/bin/wsgen"/>
    <copy file="${install.home}/lib/install/templates/xjc.template"
          tofile="${install.home}/bin/xjc"/>
    <copy file="${install.home}/lib/install/templates/schemagen.template"
          tofile="${install.home}/bin/schemagen"/>
    <copy file="${install.home}/lib/install/templates/asapt.template"
          tofile="${install.home}/bin/asapt"/>
    <copy file="${install.home}/lib/install/templates/wscompile.template"
          tofile="${install.home}/bin/wscompile"/>
    <copy file="${install.home}/lib/install/templates/wsdeploy.template"
          tofile="${install.home}/bin/wsdeploy"/>
    <copy file="${install.home}/updatecenter/lib/install/templates/updatetool.template"
          tofile="${install.home}/updatecenter/bin/updatetool"/>      
</target>

<target name="do.token" 
        depends="-do.tokenrep.common, do.token.windows, do.token.unix, do.token.jdic, do.token.enable.uc"/>

<target name="-do.tokenrep.common" depends="setup.init">
    <replace file="${asadmin.prefs.file}">
        <replacefilter token="%AS_ADMIN_PORT%" value="${admin.port}"/>
        <replacefilter token="%AS_ADMIN_PROFILE%" value="${asadmin.default.profile}"/>
        <replacefilter token="%AS_ADMIN_SECURE%" value="${asadmin.default.secure}"/>
    </replace>
</target>
<target name="do.token.windows" depends="setup.init" if="windows">
    <!-- token replacement:: bin/* -->
    <replace token="%CONFIG_HOME%"
             value="${install.home}\config"
             dir="${install.home}/bin"/>

    <replace file="${install.home}/bin/wsimport.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/wsgen.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/xjc.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/schemagen.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/asapt.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/wscompile.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/wsdeploy.bat">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>

    <!-- append imqenv:: imq/etc/imqenv.conf -->
    <echo file="${install.home}/imq/etc/imqenv.conf" append="true">
        set IMQ_DEFAULT_JAVAHOME=${java.home}\..
        set IMQ_DEFAULT_VARHOME=${install.home}\domains\${domain.name}\imq
    </echo>

    <!-- token replacement:: config/asenv.conf -->
    <replace file="${install.home}/config/asenv.bat">
        <replacefilter token="%ANT_HOME%" value="${install.home}\lib\ant"/>
        <replacefilter token="%ANT_LIB%" value="${install.home}\lib\ant\lib"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%NSS_HOME%" value="${install.home}\lib"/>
        <replacefilter token="%NSS_BIN_HOME%" value="${install.home}\lib\admincgi"/>
        <replacefilter token="%IMQ_LIB%" value="${install.home}\imq\lib"/>
        <replacefilter token="%IMQ_BIN%" value="${install.home}\imq\bin"/>
        <replacefilter token="%CONFIG_HOME%" value="${install.home}\config"/>
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
        <replacefilter token="%JHELP_HOME%" value="${install.home}\lib"/>
        <replacefilter token="%ICU_LIB%" value="${install.home}\lib"/>
        <replacefilter token="%JATO_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%WEBCONSOLE_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%USE_NATIVE_LAUNCHER%" value="false"/>
        <replacefilter token="%LAUNCHER_LIB%" value="\jre\bin\client"/>
        <replacefilter token="%JDMK_HOME%" value="${install.home}/lib/SUNWjdmk/5.1"/>
        <replacefilter token="%LOCALE%" value="en_US"/>
        <replacefilter token="%DEF_DOMAINS_PATH%" value="${install.home}\domains"/>
        <replacefilter token="%ACC_CONFIG%" value="${install.home}\domains\${domain.name}\config\sun-acc.xml"/>
        <replacefilter token="%HADB_HOME%" value=" "/>
        <replacefilter token="%MFWK_HOME%" value=" "/>
        <replacefilter token="%DERBY_HOME%" value="${install.home}\javadb"/>
    </replace>
    <!-- token replacement:: updatecenter/config/ucenv.bat -->
    <replace file="${install.home}/updatecenter/config/ucenv.bat">
        <replacefilter token="@INSTALL_HOME@" value="${install.home}\updatecenter"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
        <replacefilter token="@EXT_LIB@" value="${install.home}\updatecenter\lib\schema2beans.jar"/>
    </replace>
    <replace file="${install.home}/updatecenter/bin/updatetool.bat">
        <replacefilter token="@INSTALL_HOME@" value="${install.home}\updatecenter"/>
    </replace>
    <replace file="${install.home}/updatecenter/config/config.xml">
        <replacefilter token="%appserver_home%" value="${install.home}"/>
    </replace>

</target>
<target name="do.token.unix" depends="setup.init" if="unix">
    <!-- token replacement:: bin/* -->
    <replace token="%CONFIG_HOME%"
             value="${install.home}/config"
             dir="${install.home}/bin"/>

    <replace file="${install.home}/bin/wsimport">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/wsgen">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/xjc">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/schemagen">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/asapt">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/wscompile">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>
    <replace file="${install.home}/bin/wsdeploy">
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
    </replace>

    <!-- append imqenv:: imq/etc/imqenv.conf -->
    <echo file="${install.home}/imq/etc/imqenv.conf" append="true">
        IMQ_DEFAULT_JAVAHOME=${local.java.home}
        IMQ_DEFAULT_VARHOME=${install.home}/domains/${domain.name}/imq
    </echo>

    <!-- token replacement:: config/asenv.conf -->
    <replace file="${install.home}/config/asenv.conf">
        <replacefilter token="%ANT_HOME%" value="${install.home}/lib/ant"/>
        <replacefilter token="%ANT_LIB%" value="${install.home}/lib/ant/lib"/>
        <replacefilter token="%WEBSERVICES_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%NSS_HOME%" value="${install.home}/lib"/>
        <replacefilter token="%NSS_BIN_HOME%" value="${install.home}/lib/admincgi"/>
        <replacefilter token="%IMQ_LIB%" value="${install.home}/imq/lib"/>
        <replacefilter token="%IMQ_BIN%" value="${install.home}/imq/bin"/>
        <replacefilter token="%CONFIG_HOME%" value="${install.home}/config"/>
        <replacefilter token="%INSTALL_HOME%" value="${install.home}"/>
        <replacefilter token="%JAVA_HOME%" value="${local.java.home}"/>
        <replacefilter token="%JHELP_HOME%" value="${install.home}/lib"/>
        <replacefilter token="%ICU_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%JATO_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%WEBCONSOLE_LIB%" value="${install.home}/lib"/>
        <replacefilter token="%USE_NATIVE_LAUNCHER%" value="false"/>
        <replacefilter token="%LAUNCHER_LIB%" value="/jre/lib/i386/client"/>
        <replacefilter token="%JDMK_HOME%" value="${install.home}/lib/SUNWjdmk/5.1"/>
        <replacefilter token="%LOCALE%" value="en_US"/>
        <replacefilter token="%DEF_DOMAINS_PATH%" value="${install.home}/domains"/>
        <replacefilter token="%ACC_CONFIG%" value="${install.home}/domains/${domain.name}/config/sun-acc.xml"/>
        <replacefilter token="%HADB_HOME%" value=" "/>
        <replacefilter token="%MFWK_HOME%" value=" "/>
        <replacefilter token="%DERBY_HOME%" value="${install.home}/javadb"/>
    </replace>
    <!-- token replacement:: updatecenter/config/ucenv.conf -->
    <replace file="${install.home}/updatecenter/config/ucenv.conf">
        <replacefilter token="@INSTALL_HOME@" value="${install.home}/updatecenter"/>
        <replacefilter token="$JAVA_HOME" value="${local.java.home}"/>
        <replacefilter token="@EXT_LIB@" value="${install.home}/updatecenter/lib/schema2beans.jar"/>
    </replace>
    <replace file="${install.home}/updatecenter/bin/updatetool">
        <replacefilter token="@INSTALL_HOME@" value="${install.home}/updatecenter"/>
    </replace>
    <replace file="${install.home}/updatecenter/config/config.xml">
        <replacefilter token="%appserver_home%" value="${install.home}"/>
    </replace>

</target> 

<target name="do.token.enable.uc" if="checkbox.value">
    <replace file="${install.home}/updatecenter/config/config.xml">
        <replacefilter token="never" value="TUE"/>
    </replace>
</target>

<target name="do.token.jdic" 
        depends="do.token.jdic.windows, do.token.jdic.solaris-sparc,
        do.token.jdic.solaris-x86, do.token.jdic.linux, do.token.jdic.mac"/>                                


<target name="do.token.jdic.windows" if="windows">
    <replace file="${install.home}/updatecenter/config/ucenv.bat">
        <replacefilter token="@JDIC_LIB@" value="${install.home}\updatecenter\lib\jdic\windows\x86"/>
        <replacefilter token="@JDIC_STUB_LIB@" value="${install.home}\updatecenter\lib\jdic\windows"/>
    </replace>         
</target>

<target name="do.token.jdic.solaris-sparc" if="solaris-sparc">
    <replace file="${install.home}/updatecenter/config/ucenv.conf">
        <replacefilter token="@JDIC_LIB@" value="${install.home}/updatecenter/lib/jdic/sunos/sparc"/>
        <replacefilter token="@JDIC_STUB_LIB@" value="${install.home}/updatecenter/lib/jdic/sunos"/>
    </replace>         
</target>

<target name="do.token.jdic.solaris-x86" if="solaris-x86">
    <replace file="${install.home}/updatecenter/config/ucenv.conf">
        <replacefilter token="@JDIC_LIB@" value="${install.home}/updatecenter/lib/jdic/sunos/x86"/>
        <replacefilter token="@JDIC_STUB_LIB@" value="${install.home}/updatecenter/lib/jdic/sunos"/>
    </replace>         
</target>

<target name="do.token.jdic.linux" if="linux">
    <replace file="${install.home}/updatecenter/config/ucenv.conf">
        <replacefilter token="@JDIC_LIB@" value="${install.home}/updatecenter/lib/jdic/linux/x86"/>
        <replacefilter token="@JDIC_STUB_LIB@" value="${install.home}/updatecenter/lib/jdic/linux"/>
    </replace>         
</target>

<target name="do.token.jdic.mac" if="darwin">
    <replace file="${install.home}/updatecenter/config/ucenv.conf">
        <replacefilter token="@JDIC_LIB@" value="${install.home}/updatecenter/lib/jdic/mac/ppc"/>
        <replacefilter token="@JDIC_STUB_LIB@" value="${install.home}/updatecenter/lib/jdic/mac"/>
    </replace>         
</target>

<target name="do.chmod" depends="do.chmod.unix"/>

<target name="do.chmod.unix" depends="setup.init">
    <!-- all the executable GlassFish/bin executable files -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/bin"/>
    </chmod>
    <!-- all the GlassFish/lib libraries and helper executables -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/lib">
	    <include name="*.so"/>
	    <include name="appserv"/>
	    <include name="appservLauncher"/>
	</fileset>
    </chmod>
    <!-- the IMQ executables -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/imq/bin"/>
    </chmod>
    <!-- Apache ANT -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/lib/ant/bin">
	    <!--
	     We don't plan to run GlassFish under Cygwin.
	     Cygwin requires executable bits for all the .exe, .dll, .bat and .cmd.
	     If you want to run GlassFish under Cygwin, comment the following <exclude/>.
	    -->
	    <exclude name="*.bat"/>
	    <exclude name="*.cmd"/>
	</fileset>
    </chmod>
    <!-- Netscape security executables -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/lib/upgrade"/>
    </chmod>
    <!-- javadb -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/javadb/frameworks/NetworkServer/bin">
	    <include name="*.ksh"/>
	    <!--
	     For Cygwin use the following:
		<include name="*.bat"/>
		<include name="*.cmd"/>
	    -->
	</fileset>
    </chmod>
    <!-- updatecenter -->
    <chmod perm="ugo+x">
	<fileset dir="${install.home}/updatecenter/bin"/>
    </chmod>
</target>

<target name="create.domain" depends="setup.init,set.env">
    <exec executable="${ASADMIN}" failonerror="true">
        <arg line="create-domain" />
        <arg line="--adminport ${admin.port}" />
        <arg line="--instanceport ${instance.port}" />
        <arg line="--user ${admin.user}" />
        <arg line="--passwordfile &quot;${adminpassfile}&quot;" />
        <arg line="--domainproperties orb.listener.port=${orb.port}:jms.port=${imq.port}:http.ssl.port=${https.port}" />
        <arg line="--savelogin" />
        <arg line="${domain.name}" />
    </exec>
    <delete file="${adminpassfile}" />
</target>

<target name="clean-runtime" depends="set.env">
    <exec executable="${ASADMIN}">
        <arg line="delete-domain"/>
        <arg line="${domain.name}" />
    </exec>
    <delete>
        <fileset dir="${install.home}/config" includes="asenv*,asadmin*"/>
        <fileset dir="${install.home}/bin" excludes="*.dll"/>
    </delete>
</target>

<!-- task for creating installer -->
<taskdef name="installerBuilder"
         classname="org.jvnet.poormans_installer.builder.BuilderTask">
    <classpath>
        <fileset dir="${install.home}/lib/installer-builder">
            <include name="*.jar" />
         </fileset>
    </classpath>
</taskdef>

<target name="create-installer">
    <echo message="Creating an installer..."/>
    <installerBuilder
        licenseFile="${glassfish.license}"
        zipFile="${glassfish.zipfile}"
        classFile="${glassfish.class}"/>
</target>

<target name="compress-jars">
    <echo message="Running Jarpack on jarfiles first..."/>
    <antcall target="glassfish-jarpack"/>
    <antcall target="clean-packed-jars"/>
</target>

<target name="uncompress-jars">
    <echo message="Running Jar-Unpack on packed jarfiles..."/>
    <antcall target="glassfish-jarunpack"/>
</target>

<target name="create-zip">
    <echo message="Creating ${glassfish.zipfile} in ${install.home}..."/>
    <available file="${install.home}/../glassfish" type="dir" property="glassfish.present"/>
    <antcall target="copy-glassfish"/>
    <zip destfile="${glassfish.zipfile}"
        basedir="${install.home}/.."
        includes="glassfish/**"
        excludes="glassfish/samples/**"
    />
    <antcall target="delete-glassfish"/>
</target>

<target name="copy-glassfish" unless="glassfish.present">
    <echo message="Copying ${install.home} to ${install.home}/../glassfish"/>
    <mkdir dir="${install.home}/../glassfish"/>
    <copy  todir="${install.home}/../glassfish">
            <fileset dir="${install.home}" includes="**"/>
    </copy>
</target>

<target name="delete-glassfish" unless="glassfish.present">
     <delete dir="${install.home}/../glassfish"/>
</target>

<target name="build-jarinstaller-pe" depends="create-zip">
    <echo message="Creating installer for glassfish..."/>
    <antcall target="create-installer">
        <param name="license.file" value="${glassfish.license}"/>
        <param name="zip.file" value="${glassfish.zipfile}"/>
        <param name="class.file" value="${glassfish.class}"/>
    </antcall>
    <echo message="Creating installer jar for glassfish..."/>
    <jar destfile="../${glassfish_pe.release.name}-installer.jar" basedir="${install.home}">
        <include name="${glassfish.class}"/>
        <manifest>
            <attribute name="Main-Class" value="glassfish"/>
        </manifest>
     </jar>
     <delete file="${glassfish.zipfile}"/>
     <delete file="${glassfish.class}"/>
</target>

<target name="create-persistence-installer">
    <echo message="Creating an installer..."/>
    <installerBuilder
        licenseFile="${persistence-location}/${glassfish.license}"
        zipFile="${persistence-location}/${glassfish-persistence.zipfile}"
        classFile="${persistence-location}/${glassfish_persistence.class}"/>
</target>

<target name="create-persistence-zip">
    <echo message="Creating glassfish-persistence-image.zip..."/>
    <zip destfile="${persistence-location}/${glassfish-persistence.zipfile}"
        basedir="${persistence-location}/.."
        includes="glassfish-persistence/**"
        excludes="glassfish-persistence/*persistence*">
        <zipfileset dir="${glassfish.home}/lib" includes="toplink-essentials*.jar"
            prefix="glassfish-persistence"/>
    </zip>
</target>

<target name="build-persistence-jarinstaller" depends="create-persistence-zip">
    <echo message="Creating installer for glassfish-persistence..."/>
    <antcall target="create-persistence-installer">
        <param name="license.file" value="${persistence-location}/${glassfish.license}"/>
        <param name="zip.file" value="${persistence-location}/${glassfish-persistence.zipfile}"/>
        <param name="class.file" value="${persistence-location}/${glassfish_persistence.class}"/>
    </antcall>
    <echo message="Creating installer jar for glassfish-persistence..."/>
    <jar destfile="${persistence-location}/${glassfish.release.name}-persistence-installer.jar"
        basedir="${persistence-location}">
        <include name="${glassfish_persistence.class}"/>
        <manifest>
            <attribute name="Main-Class" value="glassfish_persistence"/>
        </manifest>
     </jar>
</target>

<target name="jarpack-tasks" >
    <taskdef name="pack200"
             classname="com.sun.tools.apache.ant.pack200.Pack200Task"
             classpath="${jarpack-task.jar}" />
    <taskdef name="unpack200"
             classname="com.sun.tools.apache.ant.pack200.Unpack200Task"
             classpath="${jarpack-task.jar}" />
</target>

<!-- Target to pack the jars using the Pack200 ant optional task -->
<target name="jar-pack" depends="jarpack-tasks"
    description="Applying the pack utility on jars">
    <mkdir dir="${pack.jar.dir}/normalized" />
    <pack200 src="${pack.jar.dir}/${pack.jar.name}"
              destfile="${pack.jar.dir}/normalized/${pack.jar.name}"
              repack="true"
              stripdebug="false"
              deflatehint="keep"
              unknownattribute="pass"
              keepfileorder="true"/>

    <pack200 src="${pack.jar.dir}/normalized/${pack.jar.name}"
              destfile="${pack.jar.dir}/normalized/${pack.jar.name}.pack.gz"
              gzipoutput="true"
              stripdebug="false"
              deflatehint="keep"
              unknownattribute="pass"
              keepfileorder="true"/>

    <unpack200 src="${pack.jar.dir}/normalized/${pack.jar.name}.pack.gz"
                dest="${pack.jar.dir}/normalized/a-${pack.jar.name}" />

    <pack200 src="${pack.jar.dir}/normalized/a-${pack.jar.name}"
             destfile="${pack.jar.dir}/${pack.jar.name}.pack.gz"
             gzipoutput="true"
             stripdebug="false"
             deflatehint="keep"
             unknownattribute="pass"
             keepfileorder="true" />

    <delete file="${pack.jar.dir}/${pack.jar.name}" />
</target>

<target name="jar-unpack" depends="jarpack-tasks">
    <unpack200 src="${pack.jar.dir}/${pack.jar.name}.pack.gz"
               dest="${pack.jar.dir}/${pack.jar.name}" />
    <delete file="${pack.jar.dir}/${pack.jar.name}.pack.gz" />
</target>

<!-- Target to pack jars that are bundled with GlassFish -->
<target name="glassfish-jarunpack" depends="setup.init" if="run-jarunpack">
    <echo message="Applying UnPack200 on Packed jars using JDK1.5 " />
    <echo message="${jarpack-task.jar}" />
    <antcall target="nonmac-jarunpack"/>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-cmp.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-jstl.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-tags.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="activation.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib/endorsed"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="webservices-api.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib/endorsed"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="webservices-rt.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="webservices-tools.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="com-sun-commons-launcher.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="j2ee-svc.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="jsf-impl.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="sun-appserv-ant.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
<!-- 
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="sun-as-jsr88-dm.jar"/> 
        <param name="pack.jar.dir" value="${install.home}/lib/deployment"/>
    </antcall>
-->
<!-- 
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="toplink-essentials.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-ext.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-rt.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
-->
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="javaee.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-admin.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="admin-cli.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-deployment-client.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-se.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="admin-cli-ee.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
</target>

<!-- Target to pack jars that are bundled with GlassFish -->
<target name="glassfish-jarpack" >
    <echo message="Applying Pack200 on GlassFish jars using JDK1.5, ${jarpack-task.jar}" />
    <antcall target="nonmac-jarpack"/>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-cmp.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-jstl.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-tags.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="activation.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib/endorsed"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="webservices-api.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib/endorsed"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="webservices-rt.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="webservices-tools.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="com-sun-commons-launcher.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="j2ee-svc.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="jsf-impl.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="sun-appserv-ant.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
<!-- 
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="sun-as-jsr88-dm.jar"/> 
        <param name="pack.jar.dir" value="${install.home}/lib/deployment"/>
    </antcall>
-->
<!--
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="toplink-essentials.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib/"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-ext.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-rt.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
-->
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="javaee.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-admin.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="admin-cli.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-deployment-client.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-se.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="admin-cli-ee.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
</target>

<target name="nonmac-jarpack" depends="setup.init" unless="darwin">
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-ext.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="toplink-essentials.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib/"/>
    </antcall>
    <antcall target="jar-pack">
        <param name="pack.jar.name" value="appserv-rt.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
</target>

<target name="nonmac-jarunpack" depends="setup.init" unless="darwin">
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-ext.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="toplink-essentials.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
    <antcall target="jar-unpack">
        <param name="pack.jar.name" value="appserv-rt.jar"/>
        <param name="pack.jar.dir" value="${install.home}/lib"/>
    </antcall>
</target>

<!-- removes the packed jars -->
<target name="clean-packed-jars" >
    <delete>
       <fileset dir="${install.home}/lib/normalized" includes="**/*" />
       <fileset dir="${install.home}/lib/endorsed/normalized" includes="**/*" />
    </delete>
    <delete dir="${install.home}/lib/normalized"/>
    <delete dir="${install.home}/lib/endorsed/normalized"/>
</target>

</project>
 
 
Close
loading
Please Confirm
Close