Added in listeners to PomTransformers. Fixed a couple of rules.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@719487 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-11-21 05:54:01 +00:00
parent 5400908c56
commit 443d49730e
1 changed files with 23 additions and 2 deletions

View File

@ -99,6 +99,8 @@ public final class PomTransformer
ProjectUri.Repositories.xUri) ));
private static Map<String, List<ModelProperty>> cache = new HashMap<String, List<ModelProperty>>();
/**
* @see ModelTransformer#transformToDomainModel(java.util.List, java.util.List)
*/
@ -110,6 +112,15 @@ public final class PomTransformer
throw new IllegalArgumentException( "properties: null" );
}
if( eventListeners == null )
{
eventListeners = new ArrayList<ModelEventListener>();
}
else
{
eventListeners = new ArrayList<ModelEventListener>(eventListeners);
}
List<ModelProperty> props = new ArrayList<ModelProperty>( properties );
//dependency management
@ -185,7 +196,7 @@ public final class PomTransformer
{
ModelDataSource executionSource = new DefaultModelDataSource();
executionSource.init( pluginContainer.getProperties(),
Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
Arrays.asList( new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory() ) );
List<ModelContainer> executionContainers =
executionSource.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri );
if ( executionContainers.size() < 2 )
@ -208,6 +219,16 @@ public final class PomTransformer
}
}
props.removeAll( removeProperties );
for(ModelEventListener listener : eventListeners)
{
ModelDataSource ds = new DefaultModelDataSource();
ds.init( props, listener.getModelContainerFactories() );
for(String uri : listener.getUris() )
{
listener.fire(ds.queryFor(uri));
}
}
return factory.createDomainModel( props );
}
@ -276,7 +297,7 @@ public final class PomTransformer
{
List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
ModelDataSource source = new DefaultModelDataSource();
source.init( tmp, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
source.init( tmp, Arrays.asList( new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory() ) );
List<ModelContainer> containers =
source.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri );
for ( ModelContainer container : containers )