You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/05/01 15:44:22 UTC
svn commit: r165504 - in /maven/maven-1/core/trunk: project.xml
src/java/org/apache/maven/jelly/tags/werkz/MavenAttainGoalTag.java
Author: brett
Date: Sun May 1 06:44:21 2005
New Revision: 165504
URL: http://svn.apache.org/viewcvs?rev=165504&view=rev
Log:
upgrade to jelly snapshot again. Don't hold state in the attain goal tag, as it is not always recreated.
Modified:
maven/maven-1/core/trunk/project.xml
maven/maven-1/core/trunk/src/java/org/apache/maven/jelly/tags/werkz/MavenAttainGoalTag.java
Modified: maven/maven-1/core/trunk/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/project.xml?rev=165504&r1=165503&r2=165504&view=diff
==============================================================================
--- maven/maven-1/core/trunk/project.xml (original)
+++ maven/maven-1/core/trunk/project.xml Sun May 1 06:44:21 2005
@@ -487,7 +487,7 @@
</dependency>
<dependency>
<id>commons-jelly</id>
- <version>1.0-beta-4</version>
+ <version>1.0-RC2-SNAPSHOT</version>
<url>http://jakarta.apache.org/commons/jelly/</url>
</dependency>
<dependency>
Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/jelly/tags/werkz/MavenAttainGoalTag.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/src/java/org/apache/maven/jelly/tags/werkz/MavenAttainGoalTag.java?rev=165504&r1=165503&r2=165504&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/jelly/tags/werkz/MavenAttainGoalTag.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/jelly/tags/werkz/MavenAttainGoalTag.java Sun May 1 06:44:21 2005
@@ -40,14 +40,14 @@
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
-public class MavenAttainGoalTag extends WerkzTagSupport
+public class MavenAttainGoalTag
+ extends WerkzTagSupport
{
- /** The goal name. */
+ /**
+ * The goal name.
+ */
private String name;
- /** The session. */
- private Session session;
-
/**
* Construct.
*/
@@ -57,44 +57,32 @@
}
/**
- * Set the <code>Session</code> to use.
- *
- * @param session The session.
- */
- public void setSession( Session session )
- {
- this.session = session;
- }
-
- /**
* Retrieve the <code>Session</code> to use, if set.
*
* @return The session or null.
*/
- public Session getSession()
+ public Session createSession()
{
- if ( this.session == null )
+ /* TODO: this is for compatibility - do we want the user to request a new session instead?
+ eg force=true on the tag
+ not great to tie variables to session if we are creating a new one */
+ Session session = (Session) getContext().getVariable( PluginManager.GLOBAL_SESSION_KEY );
+ Session newSession = new JellySession( ( (MavenJellyContext) getContext() ).getXMLOutput() );
+ for ( Iterator i = session.getAttributes().keySet().iterator(); i.hasNext(); )
{
- /* TODO: this is for compatibility - do we want the user to request a new session instead?
- eg force=true on the tag
- not great to tie variables to session if we are creating a new one */
- Session session = ( Session ) getContext().getVariable( PluginManager.GLOBAL_SESSION_KEY );
- this.session = new JellySession( ( ( MavenJellyContext ) getContext() ).getXMLOutput() );
- for ( Iterator i = session.getAttributes().keySet().iterator(); i.hasNext();)
- {
- String key = ( String ) i.next();
- this.session.setAttribute( key, session.getAttribute( key ) );
- }
+ String key = (String) i.next();
+ newSession.setAttribute( key, session.getAttribute( key ) );
}
- return this.session;
+ return newSession;
}
/**
* Evaluate the body to register all the various goals and pre/post conditions
* then run all the current targets
*/
- public void doTag( final XMLOutput output ) throws JellyTagException
+ public void doTag( final XMLOutput output )
+ throws JellyTagException
{
WerkzProject project = getProject();
@@ -108,11 +96,11 @@
try
{
// Lazy goal loading
- MavenJellyContext baseContext = ( MavenJellyContext ) getSession().getAttribute(
- PluginManager.BASE_CONTEXT );
- GoalToJellyScriptHousingMapper mapper = ( GoalToJellyScriptHousingMapper ) getSession().getAttribute(
- PluginManager.GOAL_MAPPER );
- PluginManager pluginManager = ( PluginManager ) getSession().getAttribute( PluginManager.PLUGIN_MANAGER );
+ Session session = createSession();
+ MavenJellyContext baseContext = (MavenJellyContext) session.getAttribute( PluginManager.BASE_CONTEXT );
+ GoalToJellyScriptHousingMapper mapper = (GoalToJellyScriptHousingMapper) session.getAttribute(
+ PluginManager.GOAL_MAPPER );
+ PluginManager pluginManager = (PluginManager) session.getAttribute( PluginManager.PLUGIN_MANAGER );
Set pluginSet;
try
@@ -123,7 +111,7 @@
{
throw new JellyTagException( e );
}
- project.attainGoal( getName(), getSession() );
+ project.attainGoal( getName(), session );
pluginManager.addDelayedPops( pluginSet );
}
catch ( UnattainableGoalException e )
@@ -134,7 +122,7 @@
{
if ( root instanceof JellyTagException )
{
- throw ( JellyTagException ) root;
+ throw (JellyTagException) root;
}
if ( root instanceof UnattainableGoalException )
{
@@ -160,9 +148,10 @@
* @param output The output sink.
* @throws JellyTagException If an error occurs while executing the tag.
*/
- public void invokeBody( XMLOutput output ) throws JellyTagException
+ public void invokeBody( XMLOutput output )
+ throws JellyTagException
{
- MavenJellyContext baseContext = ( MavenJellyContext ) getSession().getAttribute( PluginManager.BASE_CONTEXT );
+ MavenJellyContext baseContext = (MavenJellyContext) createSession().getAttribute( PluginManager.BASE_CONTEXT );
getBody().run( baseContext, output );
}
@@ -179,6 +168,6 @@
public WerkzProject getProject()
{
- return (WerkzProject) getContext().getVariable(MavenConstants.WERKZ_PROJECT);
+ return (WerkzProject) getContext().getVariable( MavenConstants.WERKZ_PROJECT );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org