Hi John,

Some thoughts on this...

On 10/07/2009, at 2:01 PM, [email protected] wrote:

+
+ private String getWagonHint( String protocol, String repositoryId )
+    {
+ // TODO: Implement a better way to get the hint, via settings.xml or something.

While this effectively is the same, I think it could be simplified by an actual wagon implementation that takes the http/https definitions and delegates each method call to a selected wagon impl. That way the server config is passed in using normal plexus configuration:

WagonDelegate implements Wagon, Contextualizable {

  private String wagonImpl;

  private Wagon delegate;

  contextualize() {
    delegate = container.lookup( ROLE, wagonImpl );
  }

 put( ... ) {
  delegate.put( ... );
 }
}

WDYT?

This would also avoid the ordering kludge you needed to add to the POM later.


+        if ( impl == null )
+        {
+ impl = System.getProperty( DELEGATE_PROPERTY_BASE + protocol, null );
+        }

I'd prefer the SysProp be checked in DefaultMaven (via the execution properties), like maven.artifact.threads, and then a method called on the wagon manager to set a default wagon impl (when registerWagons is called).


+    @SuppressWarnings( "unchecked" )
    public void registerWagons( Collection wagons,
                                PlexusContainer extensionContainer )
    {
-        for ( Iterator i = wagons.iterator(); i.hasNext(); )
+        for ( Iterator<String> i = wagons.iterator(); i.hasNext(); )
        {
            availableWagons.put( i.next(), extensionContainer );
        }

can change to:
for ( String protocol : wagons ) { availableWagons.put( protocol, extensionContainer ); }

        {
-            try
-            {
- Map wagons = extensionContainer.lookupMap( Wagon.ROLE ); - getLogger().debug( "Wagons to register: " + wagons.keySet() ); - wagonManager.registerWagons( wagons.keySet(), extensionContainer );
-            }
-            catch ( ComponentLookupException e )
-            {
-                // no wagons found in the extension
- getLogger().debug( "No wagons found in the extensions or other internal error: " + e.getMessage(), e );
-            }
+ Map wagons = extensionContainer.getComponentDescriptorMap( Wagon.ROLE ); + getLogger().debug( "Wagons to register: " + wagons.keySet() ); + wagonManager.registerWagons( wagons.keySet(), extensionContainer );

Is it possible wagons will be null if the prior use case is encountered, or will it return an empty map?

Cheers,
Brett




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to