plynch      2002/07/09 02:21:40

  Added:       src/plugins/j2ee plugin.jelly plugin.properties
               src/plugins/j2ee/appserver tomcat-4.x.jelly
  Log:
  o Adding core of appserver control goals
  0 Adding tomcat 4.x implementation of appserver control
  o Adding properties for the j2ee plugin
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-maven/src/plugins/j2ee/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  <?xml version="1.0"?>
  
  <project xmlns:j="jelly:core" xmlns:log="jelly:log"
   xmlns:define="jelly:define" xmlns:server="serverLib">
  
    <!-- ================================================================ -->
    <!-- A P P S E R V E R  C O N T R O L                                 -->
    <!-- ================================================================ -->
  
    <!--==================================================================-->
    <!-- S U P P O R T E D  A P P S E R V E R S                           -->
    <!--==================================================================-->
    <j:import inherit="true" uri="./appserver/tomcat-4.x.jelly" />
  
    <!--==================================================================-->
    <!-- B E G I N  C O R E  P R O C E S S I N G                          -->
    <!--==================================================================-->
    <define:taglib uri="serverLib">
      <define:jellybean name="server-started-check"
        className="org.apache.maven.jelly.tags.ServerStartedCheckTag" />
    </define:taglib>
    <server:server-started-check propertyName="maven.appserver.started"
        URL="${maven.appserver.url}"/>
  
    <available property="maven.appserver.installed"
      file="${maven.appserver.dir}" type="dir" />
  
    <j:set var="maven.appserver.fullname"
      value="${maven.appserver.name}-${maven.appserver.version}" />
  
    <!-- tell the user what Maven thinks about their appserver instance -->
    <log:info>
      <j:set var="maven.appserver.installed.msg">
        <j:choose>
          <j:when test="${maven.appserver.installed}">installed</j:when>
          <j:otherwise>not installed</j:otherwise>
        </j:choose>
      </j:set>
      <j:set var="maven.appserver.started.msg">
        <j:choose>
          <j:when test="${maven.appserver.installed}">started</j:when>
          <j:otherwise>not started</j:otherwise>
        </j:choose>
      </j:set>
      Maven has determined your <j:expr value="${maven.appserver.fullname}"/>
      appserver instance is <j:expr value="${maven.appserver.installed.msg}"/>
      in directory <j:expr value="${maven.appserver.dir}"/>
      and <j:expr value="${maven.appserver.started.msg}"/>
      on <j:expr value="${maven.appserver.url}"/>
    </log:info>
  
    <!--==================================================================-->
    <!-- I S T A L L                                                      -->
    <!--==================================================================-->
    <goal name="appserver:install"
      description="Install or reinstall a appserver instance">
      <j:choose>
        <!-- not installed - simply install -->
        <j:when test="${!maven.appserver.installed}">
          <attainGoal name="install-${maven.appserver.fullname}" />
        </j:when>
        <!-- installed and stopped -->
        <j:when
          test="${maven.appserver.installed} and ${!maven.appserver.started}">
          <attainGoal name="maven:appserver-reinstall" />
        </j:when>
        <!-- installed and started -->
        <j:when test="${maven.appserver.installed} and ${!maven.appserver.started}">
          <attain>
            <attainGoal name="appserver:stop" />
            <attainGoal name="appserver:reinstall" />
            <attainGoal name="appserver:start" />
          </attain>
        </j:when>
        <!-- one of those 'things' that should never happen -->
        <j:otherwise>
          <log:info>
            Could not determine the current status for your
            <j:expr value="${maven.appserver.fullname}"/> instance.
          </log:info>
        </j:otherwise>
      </j:choose>
  
    </goal>
  
    <!--==================================================================-->
    <!-- R E I N S T A L L                                                -->
    <!--==================================================================-->
    <!-- the purpose of this target is to allow the user to be very       -->
    <!-- specific when using pre and post goals and sometimes there may   -->
    <!-- be custom implementations of reinstall                           -->
    <goal name="appserver:reinstall"
      prereqs="install-${maven.appserver.fullname}" />
  
    <!--==================================================================-->
    <!-- S T A R T                                                        -->
    <!--==================================================================-->
    <goal name="appserver:start"
      description="Start or restart an appserver instance">
  
      <!-- property to remember what goal the user first called -->
      <property name="appserver-start.called" value="true" />
  
      <!-- must install before starting -->
      <j:if test="${!maven.appserver.installed}">
        <log:info>
          Installing the <j:expr value="${maven.appserver.fullname}"/>
          appserver instance before starting it..."/>
        </log:info>
        <attainGoal name="appserver:install" />
      </j:if>
  
      <j:choose>
        <j:when test="${maven.appserver.started}">
          <attain>
            <attainGoal name="appserver:stop" />
            <log:info>
            Restarting the <j:expr value="${maven.appserver.fullname}"/>
            appserver instance ..."/>
            </log:info>
            <attainGoal name="appserver:restart" />
          </attain>
        </j:when>
        <j:when test="${!maven.appserver.installed}">
          <log:info>
            Installing the <j:expr value="${maven.appserver.fullname}"/>
            appserver instance before starting it ..."/>
          </log:info>
          <attainGoal name="appserver:install" />
          <attainGoal name="start-${maven.appserver.fullname}"/>
        </j:when>
      </j:choose>
  
    </goal>
  
    <!--==================================================================-->
    <!-- R E S T A R T                                                    -->
    <!--==================================================================-->
    <!-- the purpose of this target is to allow the user to be very       -->
    <!-- when using pre and post goals                                    -->
    <goal name="appserver:restart"
      prereqs="start-${maven.appserver.fullname}" />
  
    <!--==================================================================-->
    <!-- S T O P                                                          -->
    <!--==================================================================-->
    <goal name="appserver:stop" description="Stop an appserver instance if started">
  
      <j:choose>
        <j:when test="${maven.appserver.installed} and ${maven.appserver.started}">
          <attainGoal
            name="stop-${maven.appserver.fullname}" />
        </j:when>
        <j:otherwise>
          <j:if test="${!appserver-clean.called}">
            <log:info>
              The <j:expr value="${maven.appserver.fullname}"/> instance
              is already stopped!
            </log:info>
          </j:if>
        </j:otherwise>
      </j:choose>
  
    </goal>
  
    <!--==================================================================-->
    <!-- C L E A N                                                        -->
    <!--==================================================================-->
    <goal name="appserver:clean"
      description="Safely delete an installed appserver instance">
  
       <!-- property to remember what goal the user first called -->
      <property name="appserver-clean.called" value="true" />
  
      <j:if test="${maven.appserver.started}">
        <log:info>
          Stopping the <j:expr value="${maven.appserver.fullname}"/>
          appserver instance before deleting it..."/>
        </log:info>
        <attainGoal name="appserver-stop" />
      </j:if>
  
      <j:if test="${maven.appserver.installed}">
        <log:info>
          Deleting the <j:expr value="${maven.appserver.fullname}"/>
          appserver instance ..."/>
        </log:info>
        <delete dir="${maven.appserver.dir}"/>
      </j:if>
  
      <j:if test="${!maven.appserver.installed}">
        <log:info>
          The <j:expr value="${maven.appserver.fullname}"/>
          appserver instance is already cleaned!"/>
        </log:info>
      </j:if>
  
    </goal>
  
  </project>
  
  
  1.1                  jakarta-turbine-maven/src/plugins/j2ee/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  # -------------------------------------------------------------------
  # Default properties for the J2EE Plugin
  # -------------------------------------------------------------------
  # These are the properties that we believe are immutable so we
  # keep them apart from the project specific properties.
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # Properties for the "war" target
  # -------------------------------------------------------------------
  
  # List of mandatory properties that need to be defined in the project
  # properties for the "war" target :
  #
  # maven.j2ee.war.name : name of the webapp
  
  # Location of where webapps are located in the source tree. There can
  # be several webapps but only one is built at a time and the one that
  # is built is the one specified by ${maven.j2ee.war.name} which must
  # be defined in the project properties.
  maven.j2ee.war.src=${maven.src.dir}/webapps
  
  # Content of the war (JSPs, HTML, etc). This can optionally include
  # WEB-INF content.
  maven.j2ee.war.content=${maven.j2ee.war.src}/${maven.j2ee.war.name}
  
  # Location of web.xml file
  maven.j2ee.war.webxml=${maven.conf.dir}/${maven.j2ee.war.name}-web.xml
  
  # Classes to include and exclude from WEB-INF/classes
  # Note: Classes are relative to build.dir
  maven.j2ee.war.classes.includes=**
  maven.j2ee.war.classes.excludes=**/package.html
  
  # Jars to include and exclude from WEB-INF/classes
  # Note: jars are relative to lib.repo
  maven.j2ee.war.lib.includes=
  
maven.j2ee.war.lib.excludes=servlet*.jar,jdbc*.jar,jms*.jar,jta*.jar,javamail*.jar,activation*.jar
  
  # -------------------------------------------------------------------
  # Properties for the "ear" target
  # -------------------------------------------------------------------
  
  # List of mandatory properties that need to be defined in the project
  # properties for the "ear" target :
  #
  # maven.j2ee.ear.name : name of the ear
  
  # Location of the ear application.xml file
  maven.j2ee.ear.appxml=${maven.conf.dir}/${maven.j2ee.ear.name}-application.xml
  
  # J2EE modules to include and exclude from the ear
  # Note: These files are relative to ${maven.build.dir}
  maven.j2ee.ear.includes=*.jar, *.war
  maven.j2ee.ear.excludes=
  
  # -------------------------------------------------------------------
  # Properties for the "ejb" target
  # -------------------------------------------------------------------
  
  # Required
  
  #maven.j2ee.ejb.name
  
  # Defaulted
  
  maven.j2ee.ejb.conf.dir=${maven.conf.dir}/${maven.j2ee.ejb.name}/
  maven.j2ee.ejb.conf.includes=ejb-jar.xml
  maven.j2ee.ejb.conf.excludes=
  maven.j2ee.ejb.includes=**
  maven.j2ee.ejb.excludes=**/package.html
  
  # Optional
  
  # Local Interfaces Jar
  #maven.j2ee.ejb.local.includes=**/interfaces/*Local*.class
  #maven.j2ee.ejb.local.excludes=**/package.html
  
  # Remote Interfaces Jar
  #maven.j2ee.ejb.remote.includes=**/interfaces/*
  #maven.j2ee.ejb.remote.excludes=**/interfaces/*Local*.class
  
  
  
  #############################################################################
  # A P P S E R V E R
  #----------------------------------------------------------------------------
  
  #
  # used to let the appserver implementation scripts know which version of j2ee we are
  # running against
  #
  maven.j2ee.version=13
  
  #
  # the place where the main install of the application server resides
  #
  maven.appserver.home=/apps/jakarta-tomcat-4
  
  #
  # a supported name of an application server instance to install
  #
  maven.appserver.name=tomcat
  
  #
  # version number of the application server, in the form of ##
  #
  maven.appserver.version=4.x
  
  #
  # ports to access this server instance
  #
  maven.appserver.port.http=8082
  maven.appserver.port.https=8083
  maven.appserver.port.one=8087
  maven.appserver.port.two=8088
  maven.appserver.port.three=8089
  
  #
  # where to install the local instance of the server
  #
  maven.appserver.dir=${basedir}/server
  
  #
  # files in an 'includes' pattern to include when controlling the server
  # For example, if you have classes in your classpath you would like to
  # include when starting the server, you could use
  # maven.appserver.classpath=${java.class.path}
  # paths can be absolute or relative to ${maven.appserver.dir} as that is
  # where a jvm will be started. This is common for libraries that need sharing
  # across all webapps installed in the server
  #
  maven.appserver.classpath=
  
  #
  # The host name, used when configuring, defaults to localhost
  #
  maven.appserver.host=localhost
  
  #
  # The URL used to test the current running status of the appserver
  #
  
maven.appserver.url=http://${maven.appserver.host}:${maven.appserver.port.http}/index.html
  
  
  
  
  
  
  
  
  
  1.1                  
jakarta-turbine-maven/src/plugins/j2ee/appserver/tomcat-4.x.jelly
  
  Index: tomcat-4.x.jelly
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
      ========================================================================
          T O M C A T  4.x  C O N T R O L
      ========================================================================
  -->
  <project>
  
      <!--
         ========================================================================
           Install and configure Tomcat 4.0 instance
         ========================================================================
      -->
      <goal name="install-tomcat-4.x">
  
          <!-- Create common directories and copy configuration files -->
          <mkdir dir="${maven.appserver.dir}/conf"/>
          <mkdir dir="${maven.appserver.dir}/work"/>
          <mkdir dir="${maven.appserver.dir}/webapps"/>
          <mkdir dir="${maven.appserver.dir}/logs"/>
  
          <!-- copy any user configuration files w/ filtering by forcing copy -->
          <!-- expecting at least a server.xml -->
          <copy todir="${maven.appserver.dir}/conf" overwrite="true">
              <fileset dir="${maven.conf.dir}/${maven.appserver.fullname}" 
excludes="**/web.xml"/>
              <filterset refid="maven.appserver.filterset" />
          </copy>
  
      </goal>
  
      <!--
         ========================================================================
           Start Tomcat 4.0
         ========================================================================
      -->
      <goal name="start-tomcat-4.x">
        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes"
          dir="${maven.appserver.dir}">
          <classpath>
            <pathelement path="${maven.appserver.classpath}"/>
            <fileset dir="${maven.appserver.home}">
              <include name="bin/bootstrap.jar"/>
            </fileset>
          </classpath>
          <jvmarg value="-Dcatalina.base=${maven.appserver.dir}"/>
          <jvmarg value="-Dcatalina.home=${maven.appserver.home}"/>
          <arg value="start"/>
        </java>
      </goal>
  
      <!--
         ========================================================================
           Stop Tomcat 4.0
         ========================================================================
      -->
      <goal name="stop-tomcat-4.x">
        <java classname="org.apache.catalina.startup.Bootstrap" fork="yes"
          dir="${maven.appserver.dir}">
          <classpath>
            <pathelement path="${maven.appserver.classpath}"/>
            <fileset dir="${maven.appserver.home}">
              <include name="bin/bootstrap.jar"/>
            </fileset>
          </classpath>
          <jvmarg value="-Dcatalina.base=${maven.appserver.dir}"/>
          <jvmarg value="-Dcatalina.home=${maven.appserver.home}"/>
          <arg value="stop"/>
        </java>
      </goal>
  
  </project>
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to