http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
new file mode 100644
index 0000000..ce14d5a
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/manual/ManualRepositorySystemFactory.java
@@ -0,0 +1,62 @@
+package org.apache.maven.resolver.examples.manual;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
+import org.eclipse.aether.impl.DefaultServiceLocator;
+import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
+import org.eclipse.aether.spi.connector.transport.TransporterFactory;
+import org.eclipse.aether.transport.file.FileTransporterFactory;
+import org.eclipse.aether.transport.http.HttpTransporterFactory;
+
+/**
+ * A factory for repository system instances that employs Aether's built-in 
service locator infrastructure to wire up
+ * the system's components.
+ */
+public class ManualRepositorySystemFactory
+{
+
+    public static RepositorySystem newRepositorySystem()
+    {
+        /*
+         * Aether's components implement 
org.eclipse.aether.spi.locator.Service to ease manual wiring and using the
+         * prepopulated DefaultServiceLocator, we only need to register the 
repository connector and transporter
+         * factories.
+         */
+        DefaultServiceLocator locator = 
MavenRepositorySystemUtils.newServiceLocator();
+        locator.addService( RepositoryConnectorFactory.class, 
BasicRepositoryConnectorFactory.class );
+        locator.addService( TransporterFactory.class, 
FileTransporterFactory.class );
+        locator.addService( TransporterFactory.class, 
HttpTransporterFactory.class );
+
+        locator.setErrorHandler( new DefaultServiceLocator.ErrorHandler()
+        {
+            @Override
+            public void serviceCreationFailed( Class<?> type, Class<?> impl, 
Throwable exception )
+            {
+                exception.printStackTrace();
+            }
+        } );
+
+        return locator.getService( RepositorySystem.class );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
new file mode 100644
index 0000000..e197624
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/plexus/PlexusRepositorySystemFactory.java
@@ -0,0 +1,53 @@
+package org.apache.maven.resolver.examples.plexus;
+
+/*
+ * 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.
+ */
+
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusConstants;
+import org.eclipse.aether.RepositorySystem;
+
+/**
+ * A factory for repository system instances that employs Plexus to wire up 
the system's components.
+ */
+public class PlexusRepositorySystemFactory
+{
+
+    public static RepositorySystem newRepositorySystem()
+    {
+        /*
+         * Aether's components are equipped with plexus-specific metadata to 
enable discovery and wiring of components
+         * by a Plexus container so this is as easy as looking up the 
implementation.
+         */
+        try
+        {
+            ContainerConfiguration config = new 
DefaultContainerConfiguration();
+            config.setAutoWiring( true );
+            config.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
+            return new DefaultPlexusContainer( config ).lookup( 
RepositorySystem.class );
+        }
+        catch ( Exception e )
+        {
+            throw new IllegalStateException( "dependency injection failed", e 
);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
new file mode 100644
index 0000000..4373dab
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/sisu/SisuRepositorySystemFactory.java
@@ -0,0 +1,58 @@
+package org.apache.maven.resolver.examples.sisu;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+import org.apache.maven.model.building.DefaultModelBuilderFactory;
+import org.apache.maven.model.building.ModelBuilder;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.sisu.launch.Main;
+
+/**
+ * A factory for repository system instances that employs Eclipse Sisu to wire 
up the system's components.
+ */
+@Named
+public class SisuRepositorySystemFactory
+{
+
+    @Inject
+    private RepositorySystem repositorySystem;
+
+    public static RepositorySystem newRepositorySystem()
+    {
+        return Main.boot( SisuRepositorySystemFactory.class ).repositorySystem;
+    }
+
+    @Named
+    private static class ModelBuilderProvider
+        implements Provider<ModelBuilder>
+    {
+
+        public ModelBuilder get()
+        {
+            return new DefaultModelBuilderFactory().newInstance();
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
new file mode 100644
index 0000000..62db10e
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
@@ -0,0 +1,73 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * A helper to boot the repository system and a repository system session.
+ */
+public class Booter
+{
+
+    public static RepositorySystem newRepositorySystem()
+    {
+        return 
org.apache.maven.resolver.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
+        // return 
org.eclipse.aether.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
+        // return 
org.eclipse.aether.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
+        // return 
org.eclipse.aether.examples.plexus.PlexusRepositorySystemFactory.newRepositorySystem();
+    }
+
+    public static DefaultRepositorySystemSession newRepositorySystemSession( 
RepositorySystem system )
+    {
+        DefaultRepositorySystemSession session = 
MavenRepositorySystemUtils.newSession();
+
+        LocalRepository localRepo = new LocalRepository( "target/local-repo" );
+        session.setLocalRepositoryManager( system.newLocalRepositoryManager( 
session, localRepo ) );
+
+        session.setTransferListener( new ConsoleTransferListener() );
+        session.setRepositoryListener( new ConsoleRepositoryListener() );
+
+        // uncomment to generate dirty trees
+        // session.setDependencyGraphTransformer( null );
+
+        return session;
+    }
+
+    public static List<RemoteRepository> newRepositories( RepositorySystem 
system, RepositorySystemSession session )
+    {
+        return new ArrayList<RemoteRepository>( Arrays.asList( 
newCentralRepository() ) );
+    }
+
+    private static RemoteRepository newCentralRepository()
+    {
+        return new RemoteRepository.Builder( "central", "default", 
"https://repo.maven.apache.org/maven2/"; ).build();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
new file mode 100644
index 0000000..ff0926e
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleDependencyGraphDumper.java
@@ -0,0 +1,157 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.
+ */
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.DependencyVisitor;
+import org.eclipse.aether.util.artifact.ArtifactIdUtils;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+import org.eclipse.aether.util.graph.transformer.ConflictResolver;
+
+/**
+ * A dependency visitor that dumps the graph to the console.
+ */
+public class ConsoleDependencyGraphDumper
+    implements DependencyVisitor
+{
+
+    private PrintStream out;
+
+    private List<ChildInfo> childInfos = new ArrayList<ChildInfo>();
+
+    public ConsoleDependencyGraphDumper()
+    {
+        this( null );
+    }
+
+    public ConsoleDependencyGraphDumper( PrintStream out )
+    {
+        this.out = ( out != null ) ? out : System.out;
+    }
+
+    public boolean visitEnter( DependencyNode node )
+    {
+        out.println( formatIndentation() + formatNode( node ) );
+        childInfos.add( new ChildInfo( node.getChildren().size() ) );
+        return true;
+    }
+
+    private String formatIndentation()
+    {
+        StringBuilder buffer = new StringBuilder( 128 );
+        for ( Iterator<ChildInfo> it = childInfos.iterator(); it.hasNext(); )
+        {
+            buffer.append( it.next().formatIndentation( !it.hasNext() ) );
+        }
+        return buffer.toString();
+    }
+
+    private String formatNode( DependencyNode node )
+    {
+        StringBuilder buffer = new StringBuilder( 128 );
+        Artifact a = node.getArtifact();
+        Dependency d = node.getDependency();
+        buffer.append( a );
+        if ( d != null && d.getScope().length() > 0 )
+        {
+            buffer.append( " [" ).append( d.getScope() );
+            if ( d.isOptional() )
+            {
+                buffer.append( ", optional" );
+            }
+            buffer.append( "]" );
+        }
+        {
+            String premanaged = DependencyManagerUtils.getPremanagedVersion( 
node );
+            if ( premanaged != null && !premanaged.equals( a.getBaseVersion() 
) )
+            {
+                buffer.append( " (version managed from " ).append( premanaged 
).append( ")" );
+            }
+        }
+        {
+            String premanaged = DependencyManagerUtils.getPremanagedScope( 
node );
+            if ( premanaged != null && !premanaged.equals( d.getScope() ) )
+            {
+                buffer.append( " (scope managed from " ).append( premanaged 
).append( ")" );
+            }
+        }
+        DependencyNode winner = (DependencyNode) node.getData().get( 
ConflictResolver.NODE_DATA_WINNER );
+        if ( winner != null && !ArtifactIdUtils.equalsId( a, 
winner.getArtifact() ) )
+        {
+            Artifact w = winner.getArtifact();
+            buffer.append( " (conflicts with " );
+            if ( ArtifactIdUtils.toVersionlessId( a ).equals( 
ArtifactIdUtils.toVersionlessId( w ) ) )
+            {
+                buffer.append( w.getVersion() );
+            }
+            else
+            {
+                buffer.append( w );
+            }
+            buffer.append( ")" );
+        }
+        return buffer.toString();
+    }
+
+    public boolean visitLeave( DependencyNode node )
+    {
+        if ( !childInfos.isEmpty() )
+        {
+            childInfos.remove( childInfos.size() - 1 );
+        }
+        if ( !childInfos.isEmpty() )
+        {
+            childInfos.get( childInfos.size() - 1 ).index++;
+        }
+        return true;
+    }
+
+    private static class ChildInfo
+    {
+
+        final int count;
+
+        int index;
+
+        public ChildInfo( int count )
+        {
+            this.count = count;
+        }
+
+        public String formatIndentation( boolean end )
+        {
+            boolean last = index + 1 >= count;
+            if ( end )
+            {
+                return last ? "\\- " : "+- ";
+            }
+            return last ? "   " : "|  ";
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
new file mode 100644
index 0000000..e1ffccf
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleRepositoryListener.java
@@ -0,0 +1,132 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.
+ */
+
+import java.io.PrintStream;
+
+import org.eclipse.aether.AbstractRepositoryListener;
+import org.eclipse.aether.RepositoryEvent;
+
+/**
+ * A simplistic repository listener that logs events to the console.
+ */
+public class ConsoleRepositoryListener
+    extends AbstractRepositoryListener
+{
+
+    private PrintStream out;
+
+    public ConsoleRepositoryListener()
+    {
+        this( null );
+    }
+
+    public ConsoleRepositoryListener( PrintStream out )
+    {
+        this.out = ( out != null ) ? out : System.out;
+    }
+
+    public void artifactDeployed( RepositoryEvent event )
+    {
+        out.println( "Deployed " + event.getArtifact() + " to " + 
event.getRepository() );
+    }
+
+    public void artifactDeploying( RepositoryEvent event )
+    {
+        out.println( "Deploying " + event.getArtifact() + " to " + 
event.getRepository() );
+    }
+
+    public void artifactDescriptorInvalid( RepositoryEvent event )
+    {
+        out.println( "Invalid artifact descriptor for " + event.getArtifact() 
+ ": "
+            + event.getException().getMessage() );
+    }
+
+    public void artifactDescriptorMissing( RepositoryEvent event )
+    {
+        out.println( "Missing artifact descriptor for " + event.getArtifact() 
);
+    }
+
+    public void artifactInstalled( RepositoryEvent event )
+    {
+        out.println( "Installed " + event.getArtifact() + " to " + 
event.getFile() );
+    }
+
+    public void artifactInstalling( RepositoryEvent event )
+    {
+        out.println( "Installing " + event.getArtifact() + " to " + 
event.getFile() );
+    }
+
+    public void artifactResolved( RepositoryEvent event )
+    {
+        out.println( "Resolved artifact " + event.getArtifact() + " from " + 
event.getRepository() );
+    }
+
+    public void artifactDownloading( RepositoryEvent event )
+    {
+        out.println( "Downloading artifact " + event.getArtifact() + " from " 
+ event.getRepository() );
+    }
+
+    public void artifactDownloaded( RepositoryEvent event )
+    {
+        out.println( "Downloaded artifact " + event.getArtifact() + " from " + 
event.getRepository() );
+    }
+
+    public void artifactResolving( RepositoryEvent event )
+    {
+        out.println( "Resolving artifact " + event.getArtifact() );
+    }
+
+    public void metadataDeployed( RepositoryEvent event )
+    {
+        out.println( "Deployed " + event.getMetadata() + " to " + 
event.getRepository() );
+    }
+
+    public void metadataDeploying( RepositoryEvent event )
+    {
+        out.println( "Deploying " + event.getMetadata() + " to " + 
event.getRepository() );
+    }
+
+    public void metadataInstalled( RepositoryEvent event )
+    {
+        out.println( "Installed " + event.getMetadata() + " to " + 
event.getFile() );
+    }
+
+    public void metadataInstalling( RepositoryEvent event )
+    {
+        out.println( "Installing " + event.getMetadata() + " to " + 
event.getFile() );
+    }
+
+    public void metadataInvalid( RepositoryEvent event )
+    {
+        out.println( "Invalid metadata " + event.getMetadata() );
+    }
+
+    public void metadataResolved( RepositoryEvent event )
+    {
+        out.println( "Resolved metadata " + event.getMetadata() + " from " + 
event.getRepository() );
+    }
+
+    public void metadataResolving( RepositoryEvent event )
+    {
+        out.println( "Resolving metadata " + event.getMetadata() + " from " + 
event.getRepository() );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
----------------------------------------------------------------------
diff --git 
a/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
new file mode 100644
index 0000000..3b3c959
--- /dev/null
+++ 
b/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/ConsoleTransferListener.java
@@ -0,0 +1,178 @@
+package org.apache.maven.resolver.examples.util;
+
+/*
+ * 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.
+ */
+
+import java.io.PrintStream;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.eclipse.aether.transfer.AbstractTransferListener;
+import org.eclipse.aether.transfer.MetadataNotFoundException;
+import org.eclipse.aether.transfer.TransferEvent;
+import org.eclipse.aether.transfer.TransferResource;
+
+/**
+ * A simplistic transfer listener that logs uploads/downloads to the console.
+ */
+public class ConsoleTransferListener
+    extends AbstractTransferListener
+{
+
+    private PrintStream out;
+
+    private Map<TransferResource, Long> downloads = new 
ConcurrentHashMap<TransferResource, Long>();
+
+    private int lastLength;
+
+    public ConsoleTransferListener()
+    {
+        this( null );
+    }
+
+    public ConsoleTransferListener( PrintStream out )
+    {
+        this.out = ( out != null ) ? out : System.out;
+    }
+
+    @Override
+    public void transferInitiated( TransferEvent event )
+    {
+        String message = event.getRequestType() == 
TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
+
+        out.println( message + ": " + event.getResource().getRepositoryUrl() + 
event.getResource().getResourceName() );
+    }
+
+    @Override
+    public void transferProgressed( TransferEvent event )
+    {
+        TransferResource resource = event.getResource();
+        downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
+
+        StringBuilder buffer = new StringBuilder( 64 );
+
+        for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
+        {
+            long total = entry.getKey().getContentLength();
+            long complete = entry.getValue().longValue();
+
+            buffer.append( getStatus( complete, total ) ).append( "  " );
+        }
+
+        int pad = lastLength - buffer.length();
+        lastLength = buffer.length();
+        pad( buffer, pad );
+        buffer.append( '\r' );
+
+        out.print( buffer );
+    }
+
+    private String getStatus( long complete, long total )
+    {
+        if ( total >= 1024 )
+        {
+            return toKB( complete ) + "/" + toKB( total ) + " KB ";
+        }
+        else if ( total >= 0 )
+        {
+            return complete + "/" + total + " B ";
+        }
+        else if ( complete >= 1024 )
+        {
+            return toKB( complete ) + " KB ";
+        }
+        else
+        {
+            return complete + " B ";
+        }
+    }
+
+    private void pad( StringBuilder buffer, int spaces )
+    {
+        String block = "                                        ";
+        while ( spaces > 0 )
+        {
+            int n = Math.min( spaces, block.length() );
+            buffer.append( block, 0, n );
+            spaces -= n;
+        }
+    }
+
+    @Override
+    public void transferSucceeded( TransferEvent event )
+    {
+        transferCompleted( event );
+
+        TransferResource resource = event.getResource();
+        long contentLength = event.getTransferredBytes();
+        if ( contentLength >= 0 )
+        {
+            String type = ( event.getRequestType() == 
TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
+            String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" 
: contentLength + " B";
+
+            String throughput = "";
+            long duration = System.currentTimeMillis() - 
resource.getTransferStartTime();
+            if ( duration > 0 )
+            {
+                long bytes = contentLength - resource.getResumeOffset();
+                DecimalFormat format = new DecimalFormat( "0.0", new 
DecimalFormatSymbols( Locale.ENGLISH ) );
+                double kbPerSec = ( bytes / 1024.0 ) / ( duration / 1000.0 );
+                throughput = " at " + format.format( kbPerSec ) + " KB/sec";
+            }
+
+            out.println( type + ": " + resource.getRepositoryUrl() + 
resource.getResourceName() + " (" + len
+                + throughput + ")" );
+        }
+    }
+
+    @Override
+    public void transferFailed( TransferEvent event )
+    {
+        transferCompleted( event );
+
+        if ( !( event.getException() instanceof MetadataNotFoundException ) )
+        {
+            event.getException().printStackTrace( out );
+        }
+    }
+
+    private void transferCompleted( TransferEvent event )
+    {
+        downloads.remove( event.getResource() );
+
+        StringBuilder buffer = new StringBuilder( 64 );
+        pad( buffer, lastLength );
+        buffer.append( '\r' );
+        out.print( buffer );
+    }
+
+    public void transferCorrupted( TransferEvent event )
+    {
+        event.getException().printStackTrace( out );
+    }
+
+    protected long toKB( long bytes )
+    {
+        return ( bytes + 1023 ) / 1024;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/maven-resolver-demo-snippets/src/site/site.xml
----------------------------------------------------------------------
diff --git a/maven-resolver-demo-snippets/src/site/site.xml 
b/maven-resolver-demo-snippets/src/site/site.xml
new file mode 100644
index 0000000..3a16bf9
--- /dev/null
+++ b/maven-resolver-demo-snippets/src/site/site.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 
http://maven.apache.org/xsd/decoration-1.0.0.xsd";>
+  <body>
+    <menu name="Overview">
+      <item name="Introduction" href="index.html"/>
+      <item name="JavaDocs" href="apidocs/index.html"/>
+      <item name="Source Xref" href="xref/index.html"/>
+      <!--item name="FAQ" href="faq.html"/-->
+    </menu>
+
+    <menu ref="parent"/>
+    <menu ref="reports"/>
+  </body>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0db86a1..cb7ac22 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,32 +29,32 @@
     <version>27</version>
   </parent>
 
-  <groupId>org.apache.maven.aether</groupId>
-  <artifactId>aether-demos</artifactId>
+  <groupId>org.apache.maven.resolver</groupId>
+  <artifactId>maven-resolver-demos</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <packaging>pom</packaging>
 
-  <name>Aether Demos</name>
+  <name>Maven Artifact Resolver Demos</name>
   <description>
-    The parent for the Aether demos.
+    The parent for the Maven Artifact Resolver demos.
   </description>
-  <url>http://maven.apache.org/aether-demos/</url>
+  <url>https://maven.apache.org/resolver-demos/</url>
   <inceptionYear>2010</inceptionYear>
 
   <scm>
-    
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-aether.git</connection>
-    
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-aether.git</developerConnection>
-    <url>https://github.com/apache/maven-aether/tree/${project.scm.tag}</url>
+    
<connection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-resolver.git</connection>
+    
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-resolver.git</developerConnection>
+    <url>https://github.com/apache/maven-resolver/tree/${project.scm.tag}</url>
     <tag>demo</tag>
   </scm>
-  <!--issueManagement>
+  <issueManagement>
     <system>jira</system>
-    <url>https://issues.apache.org/jira/browse/</url>
+    <url>https://issues.apache.org/jira/browse/MRESOLVER</url>
   </issueManagement>
   <ciManagement>
     <system>Jenkins</system>
-    <url>https://builds.apache.org/job/</url>
-  </ciManagement-->
+    <url>https://builds.apache.org/job/maven-resolver-demos</url>
+  </ciManagement>
   <distributionManagement>
     <site>
       <id>apache.website</id>
@@ -63,12 +63,12 @@
   </distributionManagement>
 
   <modules>
-    <module>aether-demo-snippets</module>
-    <module>aether-demo-maven-plugin</module>
+    <module>maven-resolver-demo-snippets</module>
+    <module>maven-resolver-demo-maven-plugin</module>
   </modules>
 
   <properties>
-    <maven.site.path>aether-archives/aether-demos-LATEST</maven.site.path>
+    <maven.site.path>resolver-archives/resolver-demos-LATEST</maven.site.path>
     
<checkstyle.violation.ignore>LineLength,MagicNumber,AvoidNestedBlocks</checkstyle.violation.ignore>
   </properties>
 

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/089cab62/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index 63dc357..6462dee 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -21,13 +21,7 @@ under the License.
 
 <project xmlns="http://maven.apache.org/DECORATION/1.1.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 
http://maven.apache.org/xsd/decoration-1.1.0.xsd";
-  name="Aether Demos">
-
-  <custom>
-    <fluidoSkin>
-      <profile>sandbox</profile>
-    </fluidoSkin>
-  </custom>
+  name="Maven Artifact Resolver Demos">
 
   <body>
     <menu name="Overview">

Reply via email to