plynch 2003/03/27 12:50:45
Modified: src/plugins-build/webserver plugin.jelly
Log:
o making maven.webserver.test.url optional
o adding a bunch of FIXME notes about the next release of werkz which hopefully
contains the already implemented session attribute on attaingoal. In the meantime the
ability to effectively use postGoal and preGoals on the primary goals of the plugin
is very limited.
If someone is reading this that has the ability to upload the latest werkz which
already contains the above feature, please upload to ibiblio, that would be great.
o improved logging in the case where only a socket is used
Revision Changes Path
1.12 +65 -30 maven/src/plugins-build/webserver/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/webserver/plugin.jelly,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- plugin.jelly 27 Mar 2003 17:29:25 -0000 1.11
+++ plugin.jelly 27 Mar 2003 20:50:44 -0000 1.12
@@ -138,9 +138,6 @@
<j:if test="${context.getVariable('maven.webserver.test.socket') == null}">
<exception:requiredPropertyMissing propname="maven.webserver.test.socket" />
</j:if>
- <j:if test="${context.getVariable('maven.webserver.test.url') == null}">
- <exception:requiredPropertyMissing propname="maven.webserver.test.url" />
- </j:if>
<j:if test="${context.getVariable('maven.webserver.root') == null}">
<exception:requiredPropertyMissing propname="maven.webserver.root" />
</j:if>
@@ -157,23 +154,6 @@
propvalue="${maven.webserver.conf.dir}" />
</j:if>
- <!-- a flag to see if the webserver is started -->
- <ant:condition property="maven.webserver.started">
- <ant:and>
- <ant:socket server="${maven.webserver.host}"
- port="${maven.webserver.test.socket}" />
- <ant:http url="${maven.webserver.test.url}" />
- </ant:and>
- </ant:condition>
-
- <!-- a flag to see if the webserver is installed -->
- <ant:condition property="maven.webserver.installed">
- <ant:and>
- <ant:available file="${maven.webserver.root}" type="dir" />
- <ant:available file="${maven.webserver.dir}" type="dir" />
- </ant:and>
- </ant:condition>
-
<!-- convert all path related properties to their os equivalent -->
<ant:property name="maven.webserver.home.path"
location="${maven.webserver.home}" />
@@ -212,6 +192,30 @@
value="${maven.webserver.root.path}" />
</ant:filterset>
+ <!-- a flag to see if the webserver is started -->
+ <ant:condition property="maven.webserver.started">
+ <ant:and>
+ <ant:socket server="${maven.webserver.host}"
+ port="${maven.webserver.test.socket}" />
+ <!-- only use the test url if defined, else just use the socket -->
+ <j:if test="${context.getVariable('maven.webserver.test.url') != null}">
+ <ant:http url="${maven.webserver.test.url}" />
+ </j:if>
+ </ant:and>
+ </ant:condition>
+
+ <!-- a flag to see if the webserver is installed -->
+ <ant:condition property="maven.webserver.installed">
+ <ant:and>
+ <ant:available file="${maven.webserver.root}" type="dir" />
+ <ant:available file="${maven.webserver.dir}" type="dir" />
+ </ant:and>
+ </ant:condition>
+
+ <j:if test="${context.getVariable('maven.webserver.started') == 'true' and
context.getVariable('maven.webserver.installed') == 'true'}">
+ <j:set var="maven.webserver.installedAndStarted" value="true" />
+ </j:if>
+
<j:set var="maven.webserver.installed.msg">
<j:choose>
<j:when test="${maven.webserver.installed}">installed</j:when>
@@ -226,13 +230,18 @@
</j:choose>
</j:set>
- <j:if test="${context.getVariable('maven.webserver.started') == 'true' and
context.getVariable('maven.webserver.installed') == 'true'}">
- <j:set var="maven.webserver.installedandStarted" value="true" />
+ <j:if test="${context.getVariable('maven.webserver.test.url') != null}">
+ <log:info trim="false">
+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.test.url}"/>
+ </log:info>
</j:if>
+ <j:if test="${context.getVariable('maven.webserver.test.url') == null}">
<log:info trim="false">
-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.test.url}"/>
+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}"/> using socket <j:expr
value="${maven.webserver.port.http}"/> on host <j:expr
value="${maven.webserver.host}"/>.
</log:info>
+ </j:if>
+
<!-- DEFINE CORE FUNCTIONALITY -->
<define:taglib uri="http://www.maven.org/plugin/webserver">
@@ -280,10 +289,24 @@
</define:tag>
<define:tag name="stop">
- <log:info trim="false">
+ <j:choose>
+
+ <j:when
test="${context.getVariable('maven.webserver.installedAndStarted') == 'true'}">
+ <log:info trim="false">
<j:expr value="${maven.webserver.fullname}" />: Stopping webserver instance ...
- </log:info>
- <attainGoal name="webserver:stop-${maven.webserver.fullname}" />
+ </log:info>
+ <attainGoal name="webserver:stop-${maven.webserver.fullname}" />
+ </j:when>
+
+ <!-- already stopped -->
+ <j:otherwise>
+ <log:info trim="false">
+<j:expr value="${maven.webserver.fullname}"/>: Already stopped!
+ </log:info>
+ </j:otherwise>
+
+ </j:choose>
+
</define:tag>
</define:taglib>
@@ -306,11 +329,13 @@
</j:when>
<!-- installed and stopped -->
<j:when test="${context.getVariable('maven.webserver.installed') == 'true'
and context.getVariable('maven.webserver.started') != 'true'}">
+ <!-- FIXME - another candidate for the attainGoal session attribute -->
<webserver:reinstall />
</j:when>
<!-- installed and started -->
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') ==
'true'}">
<attain>
+ <!-- FIXME - another candidate for the attainGoal session attribute -->
<webserver:stop />
<webserver:reinstall />
<webserver:start />
@@ -355,11 +380,21 @@
<j:choose>
<j:when test="${context.getVariable('maven.webserver.installed') != 'true'}">
<attain>
+ <!-- Use the next line when werkz beta 9 is pushed which should
+ contain a session attribute on the attainGoal tag. Using attainGoal
+ here allows the user to write post and pre goals against the
+ webserver:install goal, the likely spot where they will copy webserver
+ files to the webserver installation -->
+ <!-- <attainGoal
+ session="${context.getVariable('maven.session.global', 'parent')}"
+ name="webserver:install" /> -->
+ <!-- The next line will do until the next werkz is pushed and above line
is uncommented-->
<webserver:install />
<webserver:start />
</attain>
</j:when>
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') ==
'true'}">
+ <!-- FIXME - another candidate for the session attribute on attainGoal -->
<webserver:restart />
</j:when>
<j:when test="${context.getVariable('maven.webserver.installed') == 'true'}">
@@ -384,10 +419,8 @@
<!--==================================================================-->
<goal name="webserver:stop" prereqs="webserver:init"
description="Stop a webserver instance if started">
- <j:if test="${context.getVariable('maven.webserver.installedAndStarted') ==
'true'}">
- <webserver:stop />
- </j:if>
- </goal>
+ <webserver:stop />
+ </goal>
<!--==================================================================-->
<!-- C L E A N -->
@@ -399,7 +432,9 @@
<!-- started and installed -->
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') ==
'true'}">
+ <!-- FIXME - another candidate for attainGoal session -->
<webserver:stop />
+
<webserver:clean />
</j:when>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]