Use plugin realm to lookup plugin components - fixes custom lifecycle mappings

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@497491 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2007-01-18 16:33:34 +00:00
parent c783818ab2
commit 18b83fe00a
1 changed files with 20 additions and 9 deletions

View File

@ -1207,20 +1207,31 @@ public class DefaultPluginManager
} }
} }
public Object getPluginComponent( Plugin plugin, public Object getPluginComponent( Plugin plugin, String role, String roleHint )
String role,
String roleHint )
throws PluginManagerException, ComponentLookupException throws PluginManagerException, ComponentLookupException
{ {
// XXX this needs the plugin realm! ClassRealm pluginRealm = pluginCollector.getPluginDescriptor( plugin ).getClassRealm();
return container.lookup( role, roleHint );
if ( pluginRealm == null )
{
getLogger().warn( "getPluginComponent(" + plugin + ", " + role + "): descriptor is missing classRealm" );
pluginRealm = DefaultPlexusContainer.getLookupRealm();
}
return container.lookup( role, roleHint, pluginRealm );
} }
public Map getPluginComponents( Plugin plugin, public Map getPluginComponents( Plugin plugin, String role )
String role )
throws ComponentLookupException, PluginManagerException throws ComponentLookupException, PluginManagerException
{ {
// XXX this needs the plugin realm! ClassRealm pluginRealm = pluginCollector.getPluginDescriptor( plugin ).getClassRealm();
return container.lookupMap( role );
if ( pluginRealm == null )
{
getLogger().warn( "getPluginComponent(" + plugin + ", " + role + "): descriptor is missing classRealm" );
pluginRealm = DefaultPlexusContainer.getLookupRealm();
}
return container.lookupMap( role, pluginRealm );
} }
} }