You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2011/05/17 18:57:54 UTC

svn commit: r1104405 [4/6] - in /maven/sandbox/trunk/mae: ./ boms/ boms/mae-app-bom/ boms/mae-library-bom/ mae-api/ mae-api/src/ mae-api/src/main/ mae-api/src/main/java/ mae-api/src/main/java/org/ mae-api/src/main/java/org/apache/ mae-api/src/main/java...

Added: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBCLIManager.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBCLIManager.java?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBCLIManager.java (added)
+++ maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBCLIManager.java Tue May 17 16:57:50 2011
@@ -0,0 +1,316 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.maven.mae.boot.main;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.maven.cli.CLIManager;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+public class EMBCLIManager
+{
+
+    public static final String XAVEN_DEBUG_LOG_HANDLES = "ZX";
+
+    private final Options options;
+
+    @SuppressWarnings( "static-access" )
+    public EMBCLIManager()
+    {
+        options = new Options();
+
+        options.addOption( OptionBuilder.withLongOpt( "debug-emb" )
+                                        .hasArg()
+                                        .withDescription( "Comma-separated list of EMB log-handles to debug." )
+                                        .create( XAVEN_DEBUG_LOG_HANDLES ) );
+
+        populateNativeMavenOptions( options );
+    }
+
+    @SuppressWarnings( "static-access" )
+    private void populateNativeMavenOptions( final Options options )
+    {
+        options.addOption( OptionBuilder.withLongOpt( "file" )
+                                        .hasArg()
+                                        .withDescription( "Force the use of an alternate POM file." )
+                                        .create( CLIManager.ALTERNATE_POM_FILE ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "define" )
+                                        .hasArg()
+                                        .withDescription( "Define a system property" )
+                                        .create( CLIManager.SET_SYSTEM_PROPERTY ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "offline" )
+                                        .withDescription( "Work offline" )
+                                        .create( CLIManager.OFFLINE ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "help" )
+                                        .withDescription( "Display help information" )
+                                        .create( CLIManager.HELP ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "version" )
+                                        .withDescription( "Display version information" )
+                                        .create( CLIManager.VERSION ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "quiet" )
+                                        .withDescription( "Quiet output - only show errors" )
+                                        .create( CLIManager.QUIET ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "debug" )
+                                        .withDescription( "Produce execution debug output" )
+                                        .create( CLIManager.DEBUG ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "errors" )
+                                        .withDescription( "Produce execution error messages" )
+                                        .create( CLIManager.ERRORS ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "non-recursive" )
+                                        .withDescription( "Do not recurse into sub-projects" )
+                                        .create( CLIManager.NON_RECURSIVE ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "update-snapshots" )
+                                        .withDescription( "Forces a check for updated releases and snapshots on remote repositories" )
+                                        .create( CLIManager.UPDATE_SNAPSHOTS ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "activate-profiles" )
+                                        .withDescription( "Comma-delimited list of profiles to activate" )
+                                        .hasArg()
+                                        .create( CLIManager.ACTIVATE_PROFILES ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "batch-mode" )
+                                        .withDescription( "Run in non-interactive (batch) mode" )
+                                        .create( CLIManager.BATCH_MODE ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "no-snapshot-updates" )
+                                        .withDescription( "Supress SNAPSHOT updates" )
+                                        .create( CLIManager.SUPRESS_SNAPSHOT_UPDATES ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "strict-checksums" )
+                                        .withDescription( "Fail the build if checksums don't match" )
+                                        .create( CLIManager.CHECKSUM_FAILURE_POLICY ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "lax-checksums" )
+                                        .withDescription( "Warn if checksums don't match" )
+                                        .create( CLIManager.CHECKSUM_WARNING_POLICY ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "settings" )
+                                        .withDescription( "Alternate path for the user settings file" )
+                                        .hasArg()
+                                        .create( CLIManager.ALTERNATE_USER_SETTINGS ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "global-settings" )
+                                        .withDescription( "Alternate path for the global settings file" )
+                                        .hasArg()
+                                        .create( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "toolchains" )
+                                        .withDescription( "Alternate path for the user toolchains file" )
+                                        .hasArg()
+                                        .create( CLIManager.ALTERNATE_USER_TOOLCHAINS ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "fail-fast" )
+                                        .withDescription( "Stop at first failure in reactorized builds" )
+                                        .create( CLIManager.FAIL_FAST ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "fail-at-end" )
+                                        .withDescription( "Only fail the build afterwards; allow all non-impacted builds to continue" )
+                                        .create( CLIManager.FAIL_AT_END ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "fail-never" )
+                                        .withDescription( "NEVER fail the build, regardless of project result" )
+                                        .create( CLIManager.FAIL_NEVER ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "resume-from" )
+                                        .hasArg()
+                                        .withDescription( "Resume reactor from specified project" )
+                                        .create( CLIManager.RESUME_FROM ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "projects" )
+                                        .withDescription( "Build specified reactor projects instead of all projects. A project can be specified by [groupId]:artifactId or by its relative path." )
+                                        .hasArg()
+                                        .create( CLIManager.PROJECT_LIST ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "also-make" )
+                                        .withDescription( "If project list is specified, also build projects required by the list" )
+                                        .create( CLIManager.ALSO_MAKE ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "also-make-dependents" )
+                                        .withDescription( "If project list is specified, also build projects that depend on projects on the list" )
+                                        .create( CLIManager.ALSO_MAKE_DEPENDENTS ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "log-file" )
+                                        .hasArg()
+                                        .withDescription( "Log file to where all build output will go." )
+                                        .create( CLIManager.LOG_FILE ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "show-version" )
+                                        .withDescription( "Display version information WITHOUT stopping build" )
+                                        .create( CLIManager.SHOW_VERSION ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "encrypt-master-password" )
+                                        .hasArg()
+                                        .withDescription( "Encrypt master security password" )
+                                        .create( CLIManager.ENCRYPT_MASTER_PASSWORD ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "encrypt-password" )
+                                        .hasArg()
+                                        .withDescription( "Encrypt server password" )
+                                        .create( CLIManager.ENCRYPT_PASSWORD ) );
+
+        options.addOption( OptionBuilder.withLongOpt( "threads" )
+                                        .hasArg()
+                                        .withDescription( "Thread count, for instance 2.0C where C is core multiplied" )
+                                        .create( CLIManager.THREADS ) );
+
+        // Adding this back in for compatibility with the verifier that hard codes this option.
+
+        options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" )
+                                        .withDescription( "Ineffective, only kept for backward compatibility" )
+                                        .create( "npr" ) );
+    }
+
+    public CommandLine parse( final String[] args )
+        throws ParseException
+    {
+        // We need to eat any quotes surrounding arguments...
+        final String[] cleanArgs = cleanArgs( args );
+
+        final CommandLineParser parser = new GnuParser();
+
+        return parser.parse( options, cleanArgs );
+    }
+
+    private String[] cleanArgs( final String[] args )
+    {
+        final List<String> cleaned = new ArrayList<String>();
+
+        StringBuilder currentArg = null;
+
+        for ( int i = 0; i < args.length; i++ )
+        {
+            final String arg = args[i];
+
+            boolean addedToBuffer = false;
+
+            if ( arg.startsWith( "\"" ) )
+            {
+                // if we're in the process of building up another arg, push it and start over.
+                // this is for the case: "-Dfoo=bar "-Dfoo2=bar two" (note the first unterminated quote)
+                if ( currentArg != null )
+                {
+                    cleaned.add( currentArg.toString() );
+                }
+
+                // start building an argument here.
+                currentArg = new StringBuilder( arg.substring( 1 ) );
+                addedToBuffer = true;
+            }
+
+            // this has to be a separate "if" statement, to capture the case of: "-Dfoo=bar"
+            if ( arg.endsWith( "\"" ) )
+            {
+                final String cleanArgPart = arg.substring( 0, arg.length() - 1 );
+
+                // if we're building an argument, keep doing so.
+                if ( currentArg != null )
+                {
+                    // if this is the case of "-Dfoo=bar", then we need to adjust the buffer.
+                    if ( addedToBuffer )
+                    {
+                        currentArg.setLength( currentArg.length() - 1 );
+                    }
+                    // otherwise, we trim the trailing " and append to the buffer.
+                    else
+                    {
+                        // TODO: introducing a space here...not sure what else to do but collapse whitespace
+                        currentArg.append( ' ' ).append( cleanArgPart );
+                    }
+
+                    cleaned.add( currentArg.toString() );
+                }
+                else
+                {
+                    cleaned.add( cleanArgPart );
+                }
+
+                currentArg = null;
+
+                continue;
+            }
+
+            // if we haven't added this arg to the buffer, and we ARE building an argument
+            // buffer, then append it with a preceding space...again, not sure what else to
+            // do other than collapse whitespace.
+            // NOTE: The case of a trailing quote is handled by nullifying the arg buffer.
+            if ( !addedToBuffer )
+            {
+                if ( currentArg != null )
+                {
+                    currentArg.append( ' ' ).append( arg );
+                }
+                else
+                {
+                    cleaned.add( arg );
+                }
+            }
+        }
+
+        if ( currentArg != null )
+        {
+            cleaned.add( currentArg.toString() );
+        }
+
+        final int cleanedSz = cleaned.size();
+
+        String[] cleanArgs = null;
+
+        if ( cleanedSz == 0 )
+        {
+            cleanArgs = args;
+        }
+        else
+        {
+            cleanArgs = cleaned.toArray( new String[cleanedSz] );
+        }
+
+        return cleanArgs;
+    }
+
+    public void displayHelp( final PrintStream stdout )
+    {
+        stdout.println();
+
+        final PrintWriter pw = new PrintWriter( stdout );
+
+        final HelpFormatter formatter = new HelpFormatter();
+
+        formatter.printHelp( pw, HelpFormatter.DEFAULT_WIDTH, "xvn [options] [<goal(s)>] [<phase(s)>]", "\nOptions:",
+                             options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, "\n", false );
+
+        pw.flush();
+    }
+
+}

Propchange: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBCLIManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBMain.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBMain.java?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBMain.java (added)
+++ maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBMain.java Tue May 17 16:57:50 2011
@@ -0,0 +1,680 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.maven.mae.boot.main;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.ParseException;
+import org.apache.maven.cli.CLIManager;
+import org.apache.maven.cli.CLIReportingUtils;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionResult;
+import org.apache.maven.lifecycle.internal.LifecycleWeaveBuilder;
+import org.apache.maven.mae.MAEExecutionRequest;
+import org.apache.maven.mae.boot.embed.EMBEmbedder;
+import org.apache.maven.mae.boot.embed.EMBEmbeddingException;
+import org.apache.maven.mae.boot.log.BatchTransferListener;
+import org.apache.maven.mae.boot.log.InteractiveTransferListener;
+import org.apache.maven.model.building.ModelProcessor;
+import org.apache.maven.properties.internal.EnvironmentUtils;
+import org.apache.maven.repository.ArtifactTransferListener;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+public class EMBMain
+{
+    public static final String LOCAL_REPO_PROPERTY = "maven.repo.local";
+
+    public static final String THREADS_DEPRECATED = "maven.threads.experimental";
+
+    public static final String userHome = System.getProperty( "user.home" );
+
+    public static final File userMavenConfigurationHome = new File( userHome, ".m2" );
+
+    public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );
+
+    public static final File CONFIGURATION_DIRECTORY = userMavenConfigurationHome;
+
+    public static final File DEFAULT_GLOBAL_SETTINGS_FILE =
+        new File( System.getProperty( "maven.home", System.getProperty( "user.dir", "" ) ), "conf/settings.xml" );
+
+    public static final File DEFAULT_USER_TOOLCHAINS_FILE = new File( userMavenConfigurationHome, "toolchains.xml" );
+
+    private final ClassWorld classWorld;
+
+    public EMBMain()
+    {
+        this( null );
+    }
+
+    // This supports painless invocation by the Verifier during embedded execution of the core ITs
+    public EMBMain( final ClassWorld classWorld )
+    {
+        this.classWorld = classWorld;
+    }
+
+    public static void main( final String[] args )
+    {
+        final int result = main( args, null );
+
+        System.exit( result );
+    }
+
+    /** @noinspection ConfusingMainMethod */
+    public static int main( final String[] args, final ClassWorld classWorld )
+    {
+        final EMBMain cli = new EMBMain();
+        return cli.doMain( new CliRequest( args, classWorld ) );
+    }
+
+    public static int doMain( final String[] args, final ClassWorld classWorld )
+    {
+        final EMBMain cli = new EMBMain();
+        return cli.doMain( new CliRequest( args, classWorld ) );
+    }
+
+    // This supports painless invocation by the Verifier during embedded execution of the core ITs
+    public int doMain( final String[] args, final String workingDirectory, final PrintStream stdout,
+                       final PrintStream stderr )
+    {
+        final CliRequest cliRequest = new CliRequest( args, classWorld );
+        cliRequest.workingDirectory = workingDirectory;
+        cliRequest.builder.withStandardOut( stdout );
+        cliRequest.builder.withStandardErr( stderr );
+
+        return doMain( cliRequest );
+    }
+
+    public int doMain( final CliRequest cliRequest )
+    {
+        try
+        {
+            initialize( cliRequest );
+            // Need to process cli options first to get possible logging options
+            cli( cliRequest );
+            properties( cliRequest );
+            settings( cliRequest );
+            populateRequest( cliRequest );
+            encryption( cliRequest );
+            return execute( cliRequest );
+        }
+        catch ( final ExitException e )
+        {
+            return e.exitCode;
+        }
+        catch ( final Exception e )
+        {
+            CLIReportingUtils.showError( cliRequest.builder.logger(), "Error executing Maven.", e,
+                                         cliRequest.builder.shouldShowErrors() );
+
+            return 1;
+        }
+        finally
+        {
+            if ( cliRequest.fileStream != null )
+            {
+                cliRequest.fileStream.close();
+            }
+        }
+    }
+
+    protected void initialize( final CliRequest cliRequest )
+    {
+        if ( cliRequest.workingDirectory == null )
+        {
+            cliRequest.workingDirectory = System.getProperty( "user.dir" );
+        }
+    }
+
+    //
+    // Every bit of information taken from the CLI should be processed here.
+    //
+    protected void cli( final CliRequest cliRequest )
+        throws Exception
+    {
+        final EMBCLIManager cliManager = new EMBCLIManager();
+
+        try
+        {
+            cliRequest.commandLine = cliManager.parse( cliRequest.args );
+        }
+        catch ( final ParseException e )
+        {
+            cliRequest.builder.standardErr().println( "Unable to parse command line options: " + e.getMessage() );
+            cliManager.displayHelp( cliRequest.builder.standardOut() );
+            throw e;
+        }
+
+        cliRequest.builder.withErrorMode( cliRequest.commandLine.hasOption( CLIManager.ERRORS )
+                        || cliRequest.commandLine.hasOption( CLIManager.DEBUG ) );
+        cliRequest.builder.withDebugMode( cliRequest.commandLine.hasOption( CLIManager.DEBUG ) );
+        cliRequest.builder.withQuietMode( cliRequest.commandLine.hasOption( CLIManager.QUIET ) );
+        cliRequest.builder.withVersion( cliRequest.commandLine.hasOption( CLIManager.SHOW_VERSION ) );
+        if ( cliRequest.commandLine.hasOption( EMBCLIManager.XAVEN_DEBUG_LOG_HANDLES ) )
+        {
+            cliRequest.builder.withDebugLogHandles( cliRequest.commandLine.getOptionValue( EMBCLIManager.XAVEN_DEBUG_LOG_HANDLES )
+                                                                          .split( "\\s*,\\s*" ) );
+        }
+
+        if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
+        {
+            cliRequest.builder.withLogFile( new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE ) ) );
+        }
+
+        // TODO: these should be moved out of here. Wrong place.
+        //
+        if ( cliRequest.commandLine.hasOption( CLIManager.HELP ) )
+        {
+            cliManager.displayHelp( cliRequest.builder.standardOut() );
+            throw new ExitException( 0 );
+        }
+
+        if ( cliRequest.commandLine.hasOption( CLIManager.VERSION ) )
+        {
+            try
+            {
+                EMBEmbedder.showVersion( cliRequest.builder.embConfiguration(), cliRequest.builder.libraryLoaders(),
+                                         cliRequest.builder.standardOut() );
+            }
+            catch ( final IOException e )
+            {
+                cliRequest.builder.logger()
+                                  .error( "Failed to retrieve EMB extension information: " + e.getMessage(), e );
+            }
+
+            throw new ExitException( 0 );
+        }
+    }
+
+    protected void properties( final CliRequest cliRequest )
+    {
+        populateProperties( cliRequest.commandLine, cliRequest.systemProperties, cliRequest.userProperties );
+    }
+
+    //
+    // This should probably be a separate tool and not be baked into Maven.
+    //
+    protected void encryption( final CliRequest cliRequest )
+        throws Exception
+    {
+        if ( cliRequest.commandLine.hasOption( CLIManager.ENCRYPT_MASTER_PASSWORD ) )
+        {
+            final String passwd = cliRequest.commandLine.getOptionValue( CLIManager.ENCRYPT_MASTER_PASSWORD );
+
+            cliRequest.request.setPasswordToEncrypt( passwd );
+            cliRequest.builder.build().encryptMasterPassword( cliRequest.request );
+
+            throw new ExitException( 0 );
+        }
+        else if ( cliRequest.commandLine.hasOption( CLIManager.ENCRYPT_PASSWORD ) )
+        {
+            final String passwd = cliRequest.commandLine.getOptionValue( CLIManager.ENCRYPT_PASSWORD );
+
+            cliRequest.request.setPasswordToEncrypt( passwd );
+            cliRequest.builder.build().encryptPassword( cliRequest.request );
+
+            throw new ExitException( 0 );
+        }
+    }
+
+    protected int execute( final CliRequest cliRequest )
+        throws EMBEmbeddingException
+    {
+        final EMBEmbedder embedder = cliRequest.builder.build();
+        final MavenExecutionResult result = embedder.execute( cliRequest.request );
+
+        return embedder.formatErrorOutput( cliRequest.request, result );
+    }
+
+    protected ModelProcessor createModelProcessor( final PlexusContainer container )
+        throws ComponentLookupException
+    {
+        return container.lookup( ModelProcessor.class );
+    }
+
+    protected void settings( final CliRequest cliRequest )
+        throws Exception
+    {
+        File userSettingsFile;
+
+        if ( cliRequest.commandLine.hasOption( CLIManager.ALTERNATE_USER_SETTINGS ) )
+        {
+            userSettingsFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.ALTERNATE_USER_SETTINGS ) );
+            userSettingsFile = resolveFile( userSettingsFile, cliRequest.workingDirectory );
+
+            if ( !userSettingsFile.isFile() )
+            {
+                throw new FileNotFoundException( "The specified user settings file does not exist: " + userSettingsFile );
+            }
+        }
+        else
+        {
+            userSettingsFile = DEFAULT_USER_SETTINGS_FILE;
+        }
+
+        cliRequest.request.setUserSettingsFile( userSettingsFile );
+        cliRequest.builder.logger().debug( "Reading user settings from " + userSettingsFile );
+
+        File globalSettingsFile;
+
+        if ( cliRequest.commandLine.hasOption( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) )
+        {
+            globalSettingsFile =
+                new File( cliRequest.commandLine.getOptionValue( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) );
+            globalSettingsFile = resolveFile( globalSettingsFile, cliRequest.workingDirectory );
+
+            if ( !globalSettingsFile.isFile() )
+            {
+                throw new FileNotFoundException( "The specified global settings file does not exist: "
+                                + globalSettingsFile );
+            }
+        }
+        else
+        {
+            globalSettingsFile = DEFAULT_GLOBAL_SETTINGS_FILE;
+        }
+
+        cliRequest.request.setGlobalSettingsFile( globalSettingsFile );
+        cliRequest.builder.logger().debug( "Reading global settings from " + globalSettingsFile );
+    }
+
+    protected MAEExecutionRequest populateRequest( final CliRequest cliRequest )
+        throws EMBEmbeddingException
+    {
+        // cliRequest.builder.build();
+
+        final MAEExecutionRequest request = cliRequest.request;
+        final CommandLine commandLine = cliRequest.commandLine;
+        final String workingDirectory = cliRequest.workingDirectory;
+        final boolean debug = cliRequest.builder.shouldShowDebug();
+        final boolean quiet = cliRequest.builder.shouldBeQuiet();
+        final boolean showErrors = cliRequest.builder.shouldShowErrors();
+
+        // ----------------------------------------------------------------------
+        // Now that we have everything that we need we will fire up plexus and
+        // bring the maven component to life for use.
+        // ----------------------------------------------------------------------
+
+        if ( commandLine.hasOption( CLIManager.BATCH_MODE ) )
+        {
+            request.setInteractiveMode( false );
+            cliRequest.builder.embConfiguration().nonInteractive();
+        }
+
+        boolean noSnapshotUpdates = false;
+        if ( commandLine.hasOption( CLIManager.SUPRESS_SNAPSHOT_UPDATES ) )
+        {
+            noSnapshotUpdates = true;
+        }
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        @SuppressWarnings( "unchecked" )
+        final List<String> goals = commandLine.getArgList();
+
+        boolean recursive = true;
+
+        // this is the default behavior.
+        String reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST;
+
+        if ( commandLine.hasOption( CLIManager.NON_RECURSIVE ) )
+        {
+            recursive = false;
+        }
+
+        if ( commandLine.hasOption( CLIManager.FAIL_FAST ) )
+        {
+            reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_FAST;
+        }
+        else if ( commandLine.hasOption( CLIManager.FAIL_AT_END ) )
+        {
+            reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_AT_END;
+        }
+        else if ( commandLine.hasOption( CLIManager.FAIL_NEVER ) )
+        {
+            reactorFailureBehaviour = MavenExecutionRequest.REACTOR_FAIL_NEVER;
+        }
+
+        if ( commandLine.hasOption( CLIManager.OFFLINE ) )
+        {
+            request.setOffline( true );
+        }
+
+        boolean updateSnapshots = false;
+
+        if ( commandLine.hasOption( CLIManager.UPDATE_SNAPSHOTS ) )
+        {
+            updateSnapshots = true;
+        }
+
+        String globalChecksumPolicy = null;
+
+        if ( commandLine.hasOption( CLIManager.CHECKSUM_FAILURE_POLICY ) )
+        {
+            globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_FAIL;
+        }
+        else if ( commandLine.hasOption( CLIManager.CHECKSUM_WARNING_POLICY ) )
+        {
+            globalChecksumPolicy = MavenExecutionRequest.CHECKSUM_POLICY_WARN;
+        }
+
+        final File baseDirectory = new File( workingDirectory, "" ).getAbsoluteFile();
+
+        // ----------------------------------------------------------------------
+        // Profile Activation
+        // ----------------------------------------------------------------------
+
+        final List<String> activeProfiles = new ArrayList<String>();
+
+        final List<String> inactiveProfiles = new ArrayList<String>();
+
+        if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
+        {
+            final String[] profileOptionValues = commandLine.getOptionValues( CLIManager.ACTIVATE_PROFILES );
+            if ( profileOptionValues != null )
+            {
+                for ( int i = 0; i < profileOptionValues.length; ++i )
+                {
+                    final StringTokenizer profileTokens = new StringTokenizer( profileOptionValues[i], "," );
+
+                    while ( profileTokens.hasMoreTokens() )
+                    {
+                        final String profileAction = profileTokens.nextToken().trim();
+
+                        if ( profileAction.startsWith( "-" ) || profileAction.startsWith( "!" ) )
+                        {
+                            inactiveProfiles.add( profileAction.substring( 1 ) );
+                        }
+                        else if ( profileAction.startsWith( "+" ) )
+                        {
+                            activeProfiles.add( profileAction.substring( 1 ) );
+                        }
+                        else
+                        {
+                            activeProfiles.add( profileAction );
+                        }
+                    }
+                }
+            }
+        }
+
+        ArtifactTransferListener transferListener;
+
+        if ( request.isInteractiveMode() )
+        {
+            transferListener = new InteractiveTransferListener( cliRequest.builder.standardOut() );
+        }
+        else
+        {
+            transferListener = new BatchTransferListener( cliRequest.builder.standardOut() );
+        }
+
+        transferListener.setShowChecksumEvents( false );
+
+        String alternatePomFile = null;
+        if ( commandLine.hasOption( CLIManager.ALTERNATE_POM_FILE ) )
+        {
+            alternatePomFile = commandLine.getOptionValue( CLIManager.ALTERNATE_POM_FILE );
+        }
+
+        int loggingLevel;
+
+        if ( debug )
+        {
+            loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_DEBUG;
+        }
+        else if ( quiet )
+        {
+            // TODO: we need to do some more work here. Some plugins use sys out or log errors at info level.
+            // Ideally, we could use Warn across the board
+            loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_ERROR;
+            // TODO:Additionally, we can't change the mojo level because the component key includes the version and it
+            // isn't known ahead of time. This seems worth changing.
+        }
+        else
+        {
+            loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_INFO;
+        }
+
+        File userToolchainsFile;
+        if ( commandLine.hasOption( CLIManager.ALTERNATE_USER_TOOLCHAINS ) )
+        {
+            userToolchainsFile = new File( commandLine.getOptionValue( CLIManager.ALTERNATE_USER_TOOLCHAINS ) );
+            userToolchainsFile = resolveFile( userToolchainsFile, workingDirectory );
+        }
+        else
+        {
+            userToolchainsFile = EMBMain.DEFAULT_USER_TOOLCHAINS_FILE;
+        }
+
+        request.setBaseDirectory( baseDirectory )
+               .setGoals( goals )
+               .setSystemProperties( cliRequest.systemProperties )
+               .setUserProperties( cliRequest.userProperties )
+               .setReactorFailureBehavior( reactorFailureBehaviour )
+               // default: fail fast
+               .setRecursive( recursive )
+               // default: true
+               .setShowErrors( showErrors )
+               .addActiveProfiles( activeProfiles )
+               // optional
+               .addInactiveProfiles( inactiveProfiles )
+               // optional
+               .setLoggingLevel( loggingLevel )
+               // default: batch mode which goes along with interactive
+               .setUpdateSnapshots( updateSnapshots )
+               // default: false
+               .setNoSnapshotUpdates( noSnapshotUpdates )
+               // default: false
+               .setGlobalChecksumPolicy( globalChecksumPolicy )
+               // default: warn
+               .setUserToolchainsFile( userToolchainsFile );
+
+        if ( alternatePomFile != null )
+        {
+            final File pom = resolveFile( new File( alternatePomFile ), workingDirectory );
+
+            request.setPom( pom );
+        }
+        else
+        {
+            final File pom = cliRequest.builder.modelProcessor().locatePom( baseDirectory );
+            cliRequest.builder.resetContainer();
+
+            if ( pom.isFile() )
+            {
+                request.setPom( pom );
+            }
+        }
+
+        if ( ( request.getPom() != null ) && ( request.getPom().getParentFile() != null ) )
+        {
+            request.setBaseDirectory( request.getPom().getParentFile() );
+        }
+
+        if ( commandLine.hasOption( CLIManager.RESUME_FROM ) )
+        {
+            request.setResumeFrom( commandLine.getOptionValue( CLIManager.RESUME_FROM ) );
+        }
+
+        if ( commandLine.hasOption( CLIManager.PROJECT_LIST ) )
+        {
+            final String projectList = commandLine.getOptionValue( CLIManager.PROJECT_LIST );
+            final String[] projects = StringUtils.split( projectList, "," );
+            request.setSelectedProjects( Arrays.asList( projects ) );
+        }
+
+        if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && !commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) )
+        {
+            request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_UPSTREAM );
+        }
+        else if ( !commandLine.hasOption( CLIManager.ALSO_MAKE )
+                        && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) )
+        {
+            request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM );
+        }
+        else if ( commandLine.hasOption( CLIManager.ALSO_MAKE )
+                        && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) )
+        {
+            request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_BOTH );
+        }
+
+        String localRepoProperty = request.getUserProperties().getProperty( EMBMain.LOCAL_REPO_PROPERTY );
+
+        if ( localRepoProperty == null )
+        {
+            localRepoProperty = request.getSystemProperties().getProperty( EMBMain.LOCAL_REPO_PROPERTY );
+        }
+
+        if ( localRepoProperty != null )
+        {
+            request.setLocalRepositoryPath( localRepoProperty );
+        }
+
+        final String threadConfiguration =
+            commandLine.hasOption( CLIManager.THREADS ) ? commandLine.getOptionValue( CLIManager.THREADS )
+                            : request.getSystemProperties().getProperty( EMBMain.THREADS_DEPRECATED ); // TODO: Remove
+                                                                                                       // this setting.
+                                                                                                       // Note that the
+                                                                                                       // int-tests use
+                                                                                                       // it
+
+        if ( threadConfiguration != null )
+        {
+            request.setPerCoreThreadCount( threadConfiguration.contains( "C" ) );
+            if ( threadConfiguration.contains( "W" ) )
+            {
+                LifecycleWeaveBuilder.setWeaveMode( request.getUserProperties() );
+            }
+            request.setThreadCount( threadConfiguration.replace( "C", "" ).replace( "W", "" ).replace( "auto", "" ) );
+        }
+
+        return request;
+    }
+
+    protected File resolveFile( final File file, final String workingDirectory )
+    {
+        if ( file == null )
+        {
+            return null;
+        }
+        else if ( file.isAbsolute() )
+        {
+            return file;
+        }
+        else if ( file.getPath().startsWith( File.separator ) )
+        {
+            // drive-relative Windows path
+            return file.getAbsoluteFile();
+        }
+        else
+        {
+            return new File( workingDirectory, file.getPath() ).getAbsoluteFile();
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // System properties handling
+    // ----------------------------------------------------------------------
+
+    protected void populateProperties( final CommandLine commandLine, final Properties systemProperties,
+                                       final Properties userProperties )
+    {
+        EnvironmentUtils.addEnvVars( systemProperties );
+
+        // ----------------------------------------------------------------------
+        // Options that are set on the command line become system properties
+        // and therefore are set in the session properties. System properties
+        // are most dominant.
+        // ----------------------------------------------------------------------
+
+        if ( commandLine.hasOption( CLIManager.SET_SYSTEM_PROPERTY ) )
+        {
+            final String[] defStrs = commandLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY );
+
+            if ( defStrs != null )
+            {
+                for ( int i = 0; i < defStrs.length; ++i )
+                {
+                    setCliProperty( defStrs[i], userProperties );
+                }
+            }
+        }
+
+        systemProperties.putAll( System.getProperties() );
+    }
+
+    protected static void setCliProperty( final String property, final Properties properties )
+    {
+        String name;
+
+        String value;
+
+        final int i = property.indexOf( "=" );
+
+        if ( i <= 0 )
+        {
+            name = property.trim();
+
+            value = "true";
+        }
+        else
+        {
+            name = property.substring( 0, i ).trim();
+
+            value = property.substring( i + 1 );
+        }
+
+        properties.setProperty( name, value );
+
+        // ----------------------------------------------------------------------
+        // I'm leaving the setting of system properties here as not to break
+        // the SystemPropertyProfileActivator. This won't harm embedding. jvz.
+        // ----------------------------------------------------------------------
+
+        System.setProperty( name, value );
+    }
+
+    public static class ExitException
+        extends Exception
+    {
+
+        private static final long serialVersionUID = 1L;
+
+        public int exitCode;
+
+        public ExitException( final int exitCode )
+        {
+            this.exitCode = exitCode;
+        }
+
+    }
+
+}

Propchange: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/main/EMBMain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/DefaultEMBServiceManager.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/DefaultEMBServiceManager.java?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/DefaultEMBServiceManager.java (added)
+++ maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/DefaultEMBServiceManager.java Tue May 17 16:57:50 2011
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.maven.mae.boot.services;
+
+import org.apache.maven.DefaultMaven;
+import org.apache.maven.Maven;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequestPopulationException;
+import org.apache.maven.execution.MavenExecutionRequestPopulator;
+import org.apache.maven.mae.DefaultMAEExecutionRequest;
+import org.apache.maven.mae.boot.embed.EMBEmbeddingException;
+import org.apache.maven.mae.internal.container.ServiceAuthorizer;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.repository.RepositorySystem;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.sonatype.aether.RepositorySystemSession;
+
+@Component( role = EMBServiceManager.class )
+public class DefaultEMBServiceManager
+    implements EMBServiceManager/* , Contextualizable */
+{
+
+    // private final Logger logger = Logger.getLogger( EMBConfiguration.STANDARD_LOG_HANDLE_CORE );
+
+    @Requirement
+    private ProjectBuilder projectBuilder;
+
+    @Requirement
+    private RepositorySystem repositorySystem;
+
+    @Requirement
+    private org.sonatype.aether.RepositorySystem aetherRepositorySystem;
+
+    @Requirement
+    private ServiceAuthorizer authorizer;
+
+    @Requirement( role = Maven.class, hint = "default_" )
+    private DefaultMaven defaultMaven;
+
+    @Requirement
+    private MavenExecutionRequestPopulator requestPopulator;
+
+    private transient ArtifactRepository defaultLocalRepo;
+
+    @Requirement
+    private PlexusContainer container;
+
+    // @Inject
+    // public DefaultEMBServiceManager( final ProjectBuilder projectBuilder, final RepositorySystem repositorySystem,
+    // final org.sonatype.aether.RepositorySystem aetherRepositorySystem,
+    // final ServiceAuthorizer authorizer,
+    // @Named( "default_" ) final DefaultMaven defaultMaven,
+    // final MavenExecutionRequestPopulator requestPopulator,
+    // final PlexusContainer container )
+    // {
+    // this.projectBuilder = projectBuilder;
+    // this.repositorySystem = repositorySystem;
+    // this.aetherRepositorySystem = aetherRepositorySystem;
+    // this.authorizer = authorizer;
+    // this.defaultMaven = defaultMaven;
+    // this.requestPopulator = requestPopulator;
+    // this.container = container;
+    // }
+
+    public ProjectBuilder projectBuilder()
+    {
+        return projectBuilder;
+    }
+
+    public DefaultProjectBuildingRequest createProjectBuildingRequest()
+        throws EMBEmbeddingException
+    {
+        final DefaultProjectBuildingRequest req = new DefaultProjectBuildingRequest();
+        req.setLocalRepository( defaultLocalRepository() );
+        req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
+        req.setProcessPlugins( false );
+        req.setResolveDependencies( false );
+
+        req.setRepositorySession( createAetherRepositorySystemSession() );
+
+        return req;
+    }
+
+    public RepositorySystem mavenRepositorySystem()
+    {
+        return repositorySystem;
+    }
+
+    @Override
+    public org.sonatype.aether.RepositorySystem aetherRepositorySystem()
+    {
+        return aetherRepositorySystem;
+    }
+
+    public RepositorySystemSession createAetherRepositorySystemSession()
+        throws EMBEmbeddingException
+    {
+        try
+        {
+            final MavenExecutionRequest req =
+                requestPopulator.populateDefaults( new DefaultMAEExecutionRequest().asMavenExecutionRequest() );
+
+            return defaultMaven.newRepositorySession( req );
+        }
+        catch ( final MavenExecutionRequestPopulationException e )
+        {
+            throw new EMBEmbeddingException( "Failed to populate default Maven execution request, "
+                            + " for use in constructing a repository system session." + "\nReason: %s", e,
+                                             e.getMessage() );
+        }
+    }
+
+    public RepositorySystemSession createAetherRepositorySystemSession( final MavenExecutionRequest request )
+    {
+        return defaultMaven.newRepositorySession( request );
+    }
+
+    public synchronized ArtifactRepository defaultLocalRepository()
+        throws EMBEmbeddingException
+    {
+        if ( defaultLocalRepo == null )
+        {
+            try
+            {
+                defaultLocalRepo = mavenRepositorySystem().createDefaultLocalRepository();
+            }
+            catch ( final InvalidRepositoryException e )
+            {
+                throw new EMBEmbeddingException( "Failed to create default local-repository instance: {0}", e,
+                                                 e.getMessage() );
+            }
+        }
+
+        return defaultLocalRepo;
+    }
+
+    @Override
+    public <T> T service( final Class<T> type )
+        throws EMBEmbeddingException
+    {
+        if ( type == null )
+        {
+            throw new EMBEmbeddingException( "Invalid service: null" );
+        }
+
+        if ( !authorizer.isAvailable( type ) )
+        {
+            throw new UnauthorizedServiceException( type );
+        }
+
+        try
+        {
+            return type.cast( container.lookup( type ) );
+        }
+        catch ( final ComponentLookupException e )
+        {
+            throw new EMBEmbeddingException( "Failed to retrieve service: %s. Reason: %s", e, type.getName(),
+                                             e.getMessage() );
+        }
+    }
+
+    @Override
+    public <T> T service( final Class<T> type, final String hint )
+        throws EMBEmbeddingException
+    {
+        if ( type == null )
+        {
+            throw new EMBEmbeddingException( "Invalid service: null" );
+        }
+
+        if ( !authorizer.isAvailable( type, hint ) )
+        {
+            throw new UnauthorizedServiceException( type, hint == null ? "" : hint );
+        }
+
+        try
+        {
+            return type.cast( container.lookup( type, hint ) );
+        }
+        catch ( final ComponentLookupException e )
+        {
+            throw new EMBEmbeddingException( "Failed to retrieve service: %s with hint: %s. Reason: %s", e,
+                                             type.getName(), hint, e.getMessage() );
+        }
+    }
+
+    // @Override
+    // public void contextualize( final Context ctx )
+    // throws ContextException
+    // {
+    // container = (PlexusContainer) ctx.get( PlexusConstants.PLEXUS_KEY );
+    // }
+
+}

Propchange: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/DefaultEMBServiceManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/EMBServiceManager.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/EMBServiceManager.java?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/EMBServiceManager.java (added)
+++ maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/EMBServiceManager.java Tue May 17 16:57:50 2011
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.maven.mae.boot.services;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.mae.boot.embed.EMBEmbeddingException;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.repository.RepositorySystem;
+import org.sonatype.aether.RepositorySystemSession;
+
+public interface EMBServiceManager
+{
+
+    ProjectBuilder projectBuilder();
+
+    DefaultProjectBuildingRequest createProjectBuildingRequest()
+        throws EMBEmbeddingException;
+
+    RepositorySystem mavenRepositorySystem();
+
+    org.sonatype.aether.RepositorySystem aetherRepositorySystem();
+
+    RepositorySystemSession createAetherRepositorySystemSession()
+        throws EMBEmbeddingException;
+
+    RepositorySystemSession createAetherRepositorySystemSession( MavenExecutionRequest request );
+
+    <T> T service( Class<T> type )
+        throws EMBEmbeddingException;
+
+    <T> T service( Class<T> type, String hint )
+        throws EMBEmbeddingException;
+
+    ArtifactRepository defaultLocalRepository()
+        throws EMBEmbeddingException;
+
+}

Propchange: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/EMBServiceManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/UnauthorizedServiceException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/UnauthorizedServiceException.java?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/UnauthorizedServiceException.java (added)
+++ maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/UnauthorizedServiceException.java Tue May 17 16:57:50 2011
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.maven.mae.boot.services;
+
+import org.apache.maven.mae.boot.embed.EMBEmbeddingException;
+
+public class UnauthorizedServiceException
+    extends EMBEmbeddingException
+{
+
+    private static final long serialVersionUID = 1L;
+
+    public UnauthorizedServiceException( final Class<?> service )
+    {
+        super( "%s (with default hint) is not authorized for use outside of EMB.", service.getName() );
+    }
+
+    public UnauthorizedServiceException( final Class<?> service, final String hint )
+    {
+        super( "%s (with hint: %s) is not authorized for use outside of EMB.", service.getName(), hint );
+    }
+
+}

Propchange: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/boot/services/UnauthorizedServiceException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-booter/src/main/mdo/xaven.mdo
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/mdo/xaven.mdo?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-booter/src/main/mdo/xaven.mdo (added)
+++ maven/sandbox/trunk/mae/mae-booter/src/main/mdo/xaven.mdo Tue May 17 16:57:50 2011
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<model xmlns="http://modello.codehaus.org/MODELLO/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.2.0 http://modello.codehaus.org/xsd/modello-1.2.0.xsd"
+  xml.namespace="http://emb.org/CONFIG/${version}"
+  xml.schemaLocation="http://emb.org/xsd/emb-${version}.xsd">
+  <id>emb</id>
+  <name>EMB</name>
+  <description>
+    <![CDATA[
+    <p>This is a reference for the EMB configuration descriptor used to extend Maven.</p>
+    <p>An XSD is available at: <a href="http://emb.org/xsd/emb-1.0.0.xsd">http://emb.org/xsd/emb-1.0.0.xsd</a>
+    ]]>
+  </description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.commonjava.emb.config.model</value>
+    </default>
+  </defaults>
+  <classes>
+    <class rootElement="true" xml.tagName="emb" java.clone.hook="cloneHook">
+      <name>EMBModel</name>
+      <description>
+        <![CDATA[
+        The <code>&lt;emb&gt;</code> element is the root of the descriptor.
+        The following table lists all of the possible child elements.
+        ]]>
+      </description>
+      <version>1.0.0+</version>
+      <fields>
+
+        <field xdoc.separator="blank">
+          <name>selections</name>
+          <version>4.0.0</version>
+          <description>
+            <![CDATA[
+            Series of mappings that allows EMB to select components to substitute in place of the defaults used in Maven.
+            Formats supported include:
+            <ul>
+              <li><code>component.Role#hint=new-hint</code></li>
+              <li><code>component.Role=new-hint</code></li>
+            </ul>
+            ]]>
+          </description>
+          <type>String</type>
+          <association xml.mapStyle="inline">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>

Propchange: maven/sandbox/trunk/mae/mae-booter/src/main/mdo/xaven.mdo
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-container/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-container/pom.xml?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-container/pom.xml (added)
+++ maven/sandbox/trunk/mae/mae-container/pom.xml Tue May 17 16:57:50 2011
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2010 Red Hat, Inc.
+  
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+    http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>mae</artifactId>
+    <groupId>org.apache.maven.mae</groupId>
+    <version>0.6-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>mae-container</artifactId>
+  <name>Maven App Engine: Injectable Container</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven.mae</groupId>
+        <artifactId>mae-library-bom</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.sonatype.sisu</groupId>
+      <artifactId>sisu-inject-plexus</artifactId>
+    </dependency>
+    <!-- <dependency>
+      <groupId>org.sonatype.spice.inject</groupId>
+      <artifactId>guice-plexus-shim</artifactId>
+      <version>1.3.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.sonatype.spice.inject</groupId>
+      <artifactId>guice-plexus-metadata</artifactId>
+      <version>1.3.4</version>
+      <scope>provided</scope>
+    </dependency> -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.5.6</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+    	<groupId>org.apache.maven.mae</groupId>
+    	<artifactId>mae-api</artifactId>
+    	<version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <includes>
+              <include>**/*Test.class</include>
+            </includes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Propchange: maven/sandbox/trunk/mae/mae-container/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/mae/mae-container/src/main/java/org/apache/maven/mae/internal/container/ExtrudablePlexusContainer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-container/src/main/java/org/apache/maven/mae/internal/container/ExtrudablePlexusContainer.java?rev=1104405&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-container/src/main/java/org/apache/maven/mae/internal/container/ExtrudablePlexusContainer.java (added)
+++ maven/sandbox/trunk/mae/mae-container/src/main/java/org/apache/maven/mae/internal/container/ExtrudablePlexusContainer.java Tue May 17 16:57:50 2011
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 2010 John Casey.
+ *  
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU Affero General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Affero General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU Affero General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.apache.maven.mae.internal.container;
+
+import org.codehaus.plexus.MutablePlexusContainer;
+
+import com.google.inject.Injector;
+
+import java.util.Map;
+
+public interface ExtrudablePlexusContainer
+    extends MutablePlexusContainer
+{
+
+    Map<Object, Throwable> extrudeDependencies( Object... instances );
+
+    Injector getInjector();
+
+}

Propchange: maven/sandbox/trunk/mae/mae-container/src/main/java/org/apache/maven/mae/internal/container/ExtrudablePlexusContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native