remove context from request

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163646 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-03-22 06:51:59 +00:00
parent f07d86f311
commit fb515206b5
3 changed files with 18 additions and 33 deletions

View File

@ -16,24 +16,19 @@ package org.apache.maven.plugin;
* limitations under the License.
*/
import java.util.HashMap;
import java.util.Map;
/**
* @deprecated
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
* @deprecated
*/
public class PluginExecutionRequest
{
private Map parameters;
private Map context;
public PluginExecutionRequest( Map parameters )
{
context = new HashMap();
this.parameters = parameters;
}
@ -51,14 +46,4 @@ public class PluginExecutionRequest
{
return parameters.get( key );
}
public void addContextValue( Object key, Object value )
{
context.put( key, value );
}
public Object getContextValue( String key )
{
return context.get( key );
}
}

View File

@ -25,9 +25,6 @@ import org.codehaus.marmalade.runtime.DefaultContext;
import org.codehaus.marmalade.runtime.MarmaladeExecutionContext;
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
import java.util.Iterator;
import java.util.Map;
/**
* @author jdcasey
*/
@ -42,7 +39,8 @@ public class MarmaladeMojo
this.script = script;
}
public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
throws Exception
{
MarmaladeExecutionContext context = new DefaultContext( request.getParameters() );
@ -60,13 +58,14 @@ public class MarmaladeMojo
response.setExecutionFailure( failure );
}
Map externalizedVars = context.getExternalizedVariables();
for ( Iterator it = externalizedVars.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
request.addContextValue( entry.getKey(), entry.getValue() );
}
// TODO: need to be able to pass back results
// Map externalizedVars = context.getExternalizedVariables();
// for ( Iterator it = externalizedVars.entrySet().iterator(); it.hasNext(); )
// {
// Map.Entry entry = (Map.Entry) it.next();
//
// request.addContextValue( entry.getKey(), entry.getValue() );
// }
}
}

View File

@ -16,6 +16,7 @@ package org.apache.maven.script.marmalade;
* limitations under the License.
*/
import junit.framework.TestCase;
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import org.codehaus.marmalade.metamodel.ScriptBuilder;
@ -27,8 +28,6 @@ import org.codehaus.marmalade.parsing.ScriptParser;
import java.io.StringReader;
import java.util.Collections;
import junit.framework.TestCase;
/**
* @author jdcasey
*/
@ -38,7 +37,8 @@ public class MarmaladeMojoTest
private static final String TEST_SCRIPT = "<set xmlns=\"marmalade:core\" var=\"testvar\" value=\"${param}/testval\" extern=\"true\"/>";
public void testShouldProduceOutputWithRequest_Dot_ToStringInline() throws Exception
public void testShouldProduceOutputWithRequest_Dot_ToStringInline()
throws Exception
{
MarmaladeParsingContext parseContext = new DefaultParsingContext();
parseContext.setInput( new StringReader( TEST_SCRIPT ) );
@ -57,9 +57,10 @@ public class MarmaladeMojoTest
mojo.execute( request, response );
Object result = request.getContextValue( "testvar" );
assertEquals( "paramValue/testval", result );
// TODO: need to be able to pass back results
// Object result = request.getContextValue( "testvar" );
//
// assertEquals( "paramValue/testval", result );
}
}