jvanzyl     2002/07/08 06:24:27

  Added:       src/plugins/webserver plugin.jelly.org
  Removed:     src/plugins/webserver plugin.jelly
  Log:
  o Will fix later but for now renaming because the relative link
    at the top messes up building anything but maven.
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-maven/src/plugins/webserver/plugin.jelly.org
  
  Index: plugin.jelly.org
  ===================================================================
  <?xml version="1.0"?>
  
  <!DOCTYPE project [
      <!ENTITY apache-2.x SYSTEM "./src/plugins/webserver/apache-2.x.jelly">
  ]>
  <!-- ================================================================== -->
  <!-- W E B S E R V E R  P L U G I N                                     -->
  <!-- ================================================================== -->
  <project xmlns:j="jelly:core" xmlns:log="jelly:log"
   xmlns:define="jelly:define" xmlns:server="serverLib">
  
    <!--==================================================================-->
    <!-- S U P P O R T E D  W E B S E R V E R S                           -->
    <!--==================================================================-->
    <!-- include the implmentation entities here -->
    &apache-2.x;
  
    <!--==================================================================-->
    <!-- B E G I N  C O R E  P R O C E S S I N G                          -->
    <!--==================================================================-->
  
    <!-- BOB - this causes the null pointer -->
    <define:taglib uri="serverLib">
      <define:jellybean name="server-started-check"
        className="org.apache.maven.jelly.tags.ServerStartedCheckTag"
        method="execute" />
    </define:taglib>
    <server:server-started-check propertyName="maven.webserver.started"
        URL="${maven.webserver.url}"/>
  
  
    <!-- BOB -->
    <!-- This works as long as I define the task in maven-task-defs.properties -->
    <!--
    <taskdef name="server-started-check"
      classname="org.apache.maven.ant.ServerStartedCheckTask" />
    <server-started-check propertyName="maven.webserver.started"
        URL="${maven.webserver.url}"/>
        -->
  
    <available property="maven.webserver.installed"
      file="${maven.webserver.dir}" type="dir" />
  
    <j:set var="maven.webserver.fullname"
      value="${maven.webserver.name}-${maven-webserver.version}" />
  
    <!-- tell the user what Maven thinks about their webserver instance -->
    <log:info>
      <j:set var="maven.webserver.installed.msg">
        <j:choose>
          <j:when test="${maven.webserver.installed}">installed</j:when>
          <j:otherwise>not installed</j:otherwise>
        </j:choose>
      </j:set>
      <j:set var="maven.webserver.started.msg">
        <j:choose>
          <j:when test="${maven.webserver.installed}">started</j:when>
          <j:otherwise>not started</j:otherwise>
        </j:choose>
      </j:set>
      Maven has determined your <j:expr value="${maven.webserver.fullname}"/>
      webserver instance is <j:expr value="${maven.webserver.installed.msg}"/>
      in directory <j:expr value="${maven.webserver.dir}"/>
      and <j:expr value="${maven.webserver.started.msg}"/>
      on <j:expr value="${maven.webserver.url}"/>
    </log:info>
  
    <!--==================================================================-->
    <!-- I S T A L L                                                      -->
    <!--==================================================================-->
    <goal name="webserver:install"
      description="Install a webserver instance.">
  
      <j:choose>
        <!-- not installed - simply install -->
        <j:when test="${!maven.webserver.installed}">
          <attainGoal name="install-${maven.webserver.fullname}" />
        </j:when>
        <!-- installed and stopped -->
        <j:when
          test="${maven.webserver.installed} and ${!maven.webserver.started}">
          <attainGoal name="maven:webserver-reinstall" />
        </j:when>
        <!-- installed and started -->
        <j:when test="${maven.webserver.installed} and ${!maven.webserver.started}">
          <attain>
            <attainGoal name="webserver:stop" />
            <attainGoal name="webserver:reinstall" />
            <attainGoal name="webserver: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.webserver.name}"/>-<j:expr 
value="${maven-webserver.version}"/>
            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       -->
    <!-- when using pre and post goals                                    -->
    <goal name="webserver:reinstall"
      prereqs="install-${maven.webserver.fullname}" />
  
    <!--==================================================================-->
    <!-- S T O P                                                          -->
    <!--==================================================================-->
    <goal name="webserver:stop" description="Stop a started webserver">
  
      <j:choose>
        <j:when test="${maven.webserver.installed} and ${maven.webserver.started}">
          <attainGoal
            name="stop-${maven.webserver.fullname}" />
        </j:when>
        <j:otherwise>
          <j:if test="${!webserver-clean.called}">
            <log:info>
              The <j:expr value="${maven.webserver.fullname}"/>
              is already stopped!
            </log:info>
          </j:if>
        </j:otherwise>
      </j:choose>
  
    </goal>
  
  
    <!--==================================================================-->
    <!-- S T A R T                                                        -->
    <!--==================================================================-->
    <goal name="webserver:start"
      description="Start a webserver instance">
  
      <!-- property to remember what goal the user first called -->
      <property name="webserver-start.called" value="true" />
  
      <!-- must install before starting -->
      <j:if test="${!maven.webserver.installed}">
        <log:info>
          Installing the <j:expr value="${maven.webserver.fullname}"/>
          webserver instance before starting it..."/>
        </log:info>
        <attainGoal name="webserver:install" />
      </j:if>
  
      <j:choose>
        <j:when test="${maven.webserver.started}">
          <attain>
            <attainGoal name="webserver:stop" />
            <log:info>
            Restarting the <j:expr value="${maven.webserver.fullname}"/>
            webserver instance ..."/>
            </log:info>
            <attainGoal name="webserver:restart" />
          </attain>
        </j:when>
        <j:when test="${!maven.webserver.installed}">
          <log:info>
            Installing the <j:expr value="${maven.webserver.fullname}"/>
            webserver instance before starting it ..."/>
          </log:info>
          <attainGoal name="webserver:install" />
          <attainGoal name="start-${maven.webserver.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="webserver:restart"
      prereqs="start-${maven.webserver.name}-${maven-webserver.version}" />
  
  
    <!--==================================================================-->
    <!-- C L E A N                                                        -->
    <!--==================================================================-->
    <goal name="webserver:clean"
      description="Safely delete a webserver instance install">
  
      <j:if test="${maven.webserver.started}">
        <log:info>
          Stopping the <j:expr value="${maven.webserver.fullname}"/>
          webserver instance before deleting it..."/>
        </log:info>
        <attainGoal name="webserver-stop" />
      </j:if>
  
      <j:if test="${maven.webserver.installed}">
        <log:info>
          Deleting the <j:expr value="${maven.webserver.fullname}"/>
          webserver instance ..."/>
        </log:info>
        <delete dir="${maven.webserver.dir}"/>
      </j:if>
  
      <j:if test="${!maven.webserver.installed}">
        <log:info>
          The <j:expr value="${maven.webserver.fullname}"/>
          webserver instance is already cleaned!"/>
        </log:info>
      </j:if>
  
    </goal>
  
  </project>
  
  

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

Reply via email to