o renaming the embedder request to embedder configuration which is more appropropriate

o move toward using one constructor which takes a configuration for session wide configuration, the execution still 
  takes an execution request as per usual



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@505664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-02-10 09:20:11 +00:00
parent 17817ccc00
commit 1ff7c5a235
6 changed files with 35 additions and 37 deletions

View File

@ -27,7 +27,7 @@
<artifactId>maven-embedder</artifactId>
<name>Maven Embedder</name>
<properties>
<bundleVersion>2.1.0.v20070209-2050</bundleVersion>
<bundleVersion>2.1.0.v20070209-2105</bundleVersion>
</properties>
<build>
<resources>

View File

@ -25,12 +25,12 @@ import org.apache.maven.settings.Settings;
import org.codehaus.plexus.classworlds.ClassWorld;
/**
* Default implementation of MavenEmbedRequest intefrace.
* Default implementation of MavenEmbedderConfiguration intefrace.
*
* @author mkleint
*/
public class DefaultMavenEmbedRequest
implements MavenEmbedRequest
public class DefaultMavenEmbedderConfiguration
implements MavenEmbedderConfiguration
{
private List inactives;
@ -53,30 +53,30 @@ public class DefaultMavenEmbedRequest
private ClassWorld classWorld;
/** Creates a new instance of DefaultMavenEmbedRequest */
public DefaultMavenEmbedRequest()
/** Creates a new instance of DefaultMavenEmbedderConfiguration */
public DefaultMavenEmbedderConfiguration()
{
}
public MavenEmbedRequest addActiveProfile( String profile )
public MavenEmbedderConfiguration addActiveProfile( String profile )
{
getActiveProfiles().add( profile );
return this;
}
public MavenEmbedRequest addInactiveProfile( String profile )
public MavenEmbedderConfiguration addInactiveProfile( String profile )
{
getInactiveProfiles().add( profile );
return this;
}
public MavenEmbedRequest addActiveProfiles( List profiles )
public MavenEmbedderConfiguration addActiveProfiles( List profiles )
{
getActiveProfiles().addAll( profiles );
return this;
}
public MavenEmbedRequest addInactiveProfiles( List profiles )
public MavenEmbedderConfiguration addInactiveProfiles( List profiles )
{
getInactiveProfiles().addAll( profiles );
return this;
@ -100,13 +100,13 @@ public class DefaultMavenEmbedRequest
return inactives;
}
public MavenEmbedRequest setUserSettingsFile( File user )
public MavenEmbedderConfiguration setUserSettingsFile( File user )
{
userSettings = user;
return this;
}
public MavenEmbedRequest setGlobalSettingsFile( File global )
public MavenEmbedderConfiguration setGlobalSettingsFile( File global )
{
globalSettings = global;
return this;
@ -122,7 +122,7 @@ public class DefaultMavenEmbedRequest
return globalSettings;
}
public MavenEmbedRequest setConfigurationCustomizer( ContainerCustomizer customizer )
public MavenEmbedderConfiguration setConfigurationCustomizer( ContainerCustomizer customizer )
{
this.customizer = customizer;
return this;
@ -133,7 +133,7 @@ public class DefaultMavenEmbedRequest
return customizer;
}
public MavenEmbedRequest setSystemProperties( Properties properties )
public MavenEmbedderConfiguration setSystemProperties( Properties properties )
{
systemProperties = properties;
return this;
@ -154,7 +154,7 @@ public class DefaultMavenEmbedRequest
return extensions;
}
public MavenEmbedRequest setMavenEmbedderLogger( MavenEmbedderLogger logger )
public MavenEmbedderConfiguration setMavenEmbedderLogger( MavenEmbedderLogger logger )
{
this.logger = logger;
return this;
@ -170,13 +170,13 @@ public class DefaultMavenEmbedRequest
return classWorld;
}
public MavenEmbedRequest setClassWorld( ClassWorld classWorld )
public MavenEmbedderConfiguration setClassWorld( ClassWorld classWorld )
{
this.classWorld = classWorld;
return this;
}
public MavenEmbedRequest setClassLoader( ClassLoader loader )
public MavenEmbedderConfiguration setClassLoader( ClassLoader loader )
{
this.classWorld = new ClassWorld( "plexus.core", loader );
return this;

View File

@ -142,7 +142,7 @@ public class MavenEmbedder
// User options
// ----------------------------------------------------------------------
private MavenEmbedRequest embedderRequest;
private MavenEmbedderConfiguration embedderRequest;
// ----------------------------------------------------------------------------
// Constructors
@ -158,7 +158,7 @@ public class MavenEmbedder
MavenEmbedderLogger logger )
throws MavenEmbedderException
{
this( new DefaultMavenEmbedRequest().setClassWorld( classWorld ).setMavenEmbedderLogger( logger ) );
this( new DefaultMavenEmbedderConfiguration().setClassWorld( classWorld ).setMavenEmbedderLogger( logger ) );
}
public MavenEmbedder( ClassLoader classLoader )
@ -174,10 +174,10 @@ public class MavenEmbedder
this( new ClassWorld( "plexus.core", classLoader ), logger );
}
public MavenEmbedder( MavenEmbedRequest req )
public MavenEmbedder( MavenEmbedderConfiguration embedderConfiguration )
throws MavenEmbedderException
{
start( req );
start( embedderConfiguration );
}
// ----------------------------------------------------------------------
@ -488,7 +488,7 @@ public class MavenEmbedder
// Lifecycle
// ----------------------------------------------------------------------
private void start( MavenEmbedRequest req )
private void start( MavenEmbedderConfiguration req )
throws MavenEmbedderException
{
this.classWorld = req.getClassWorld();

View File

@ -27,46 +27,46 @@ import org.codehaus.plexus.classworlds.ClassWorld;
*
* @author mkleint
*/
public interface MavenEmbedRequest
public interface MavenEmbedderConfiguration
{
/*
* Add profile to activate.
*/
MavenEmbedRequest addActiveProfile( String profile );
MavenEmbedderConfiguration addActiveProfile( String profile );
/*
* Add profile to inactivate.
*/
MavenEmbedRequest addInactiveProfile( String profile );
MavenEmbedderConfiguration addInactiveProfile( String profile );
/*
* Add a list of String instances with names of profiles to activate.
*/
MavenEmbedRequest addActiveProfiles( List profiles );
MavenEmbedderConfiguration addActiveProfiles( List profiles );
/*
* Add a list of String instances with names of profiles to inactivate.
*/
MavenEmbedRequest addInactiveProfiles( List profiles );
MavenEmbedderConfiguration addInactiveProfiles( List profiles );
/*
* Set location of the user settings file to use for the embedder.
*/
MavenEmbedRequest setUserSettingsFile( File user );
MavenEmbedderConfiguration setUserSettingsFile( File user );
/*
* Set location of the global settings file to use for the embedder.
*/
MavenEmbedRequest setGlobalSettingsFile( File global );
MavenEmbedderConfiguration setGlobalSettingsFile( File global );
/**
* Set a customizer callback implemetation that will be given a chance to modify the plexus container
* on startup.
*/
MavenEmbedRequest setConfigurationCustomizer( ContainerCustomizer customizer );
MavenEmbedderConfiguration setConfigurationCustomizer( ContainerCustomizer customizer );
/** set the system properties to be used during the lifecycle of the embedder. Excluding the time when executing the project, then the properties from MavenExecutionRequestare used. */
MavenEmbedRequest setSystemProperties( Properties properties );
MavenEmbedderConfiguration setSystemProperties( Properties properties );
List getActiveProfiles();
@ -84,13 +84,13 @@ public interface MavenEmbedRequest
List getExtensions();
public MavenEmbedRequest setMavenEmbedderLogger( MavenEmbedderLogger logger );
public MavenEmbedderConfiguration setMavenEmbedderLogger( MavenEmbedderLogger logger );
public MavenEmbedderLogger getMavenEmbedderLogger();
public ClassWorld getClassWorld();
public MavenEmbedRequest setClassWorld( ClassWorld classWorld );
public MavenEmbedderConfiguration setClassWorld( ClassWorld classWorld );
public MavenEmbedRequest setClassLoader( ClassLoader loader );
public MavenEmbedderConfiguration setClassLoader( ClassLoader loader );
}

View File

@ -230,8 +230,6 @@ public class MavenEmbedderTest
assertEquals( 1, artifacts.size() );
Artifact artifact = (Artifact) artifacts.iterator().next();
System.out.println( "artifact = " + artifact );
}
public void testProjectWithExtensionsReading()

View File

@ -25,7 +25,7 @@ public class TestComponentOverride
ClassLoader loader = Thread.currentThread().getContextClassLoader();
MavenEmbedRequest request = new DefaultMavenEmbedRequest();
MavenEmbedderConfiguration request = new DefaultMavenEmbedderConfiguration();
request.setClassLoader( loader );