o Polished realm creation

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@820597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-10-01 10:21:02 +00:00
parent f66bbf1172
commit 58a24ac941
1 changed files with 8 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public class DefaultClassRealmManager
* @param imports The packages/types to import from the parent realm, may be {@code null}. * @param imports The packages/types to import from the parent realm, may be {@code null}.
* @return The created class realm, never {@code null}. * @return The created class realm, never {@code null}.
*/ */
private ClassRealm createRealm( String baseRealmId, ClassLoader parent, List<String> imports ) private ClassRealm createRealm( String baseRealmId, ClassLoader parent, List<String> imports, boolean importXpp3Dom )
{ {
ClassWorld world = getClassWorld(); ClassWorld world = getClassWorld();
@ -108,7 +108,10 @@ public class DefaultClassRealmManager
importMavenApi( classRealm ); importMavenApi( classRealm );
} }
importXpp3Dom( classRealm ); if ( importXpp3Dom )
{
importXpp3Dom( classRealm );
}
if ( imports != null && !imports.isEmpty() ) if ( imports != null && !imports.isEmpty() )
{ {
@ -189,7 +192,7 @@ public class DefaultClassRealmManager
throw new IllegalArgumentException( "model missing" ); throw new IllegalArgumentException( "model missing" );
} }
return createRealm( getKey( model ), null, null ); return createRealm( getKey( model ), null, null, false );
} }
private String getKey( Model model ) private String getKey( Model model )
@ -204,7 +207,7 @@ public class DefaultClassRealmManager
throw new IllegalArgumentException( "extension plugin missing" ); throw new IllegalArgumentException( "extension plugin missing" );
} }
return createRealm( getKey( plugin, true ), null, null ); return createRealm( getKey( plugin, true ), null, null, true );
} }
public ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> imports ) public ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> imports )
@ -214,7 +217,7 @@ public class DefaultClassRealmManager
throw new IllegalArgumentException( "plugin missing" ); throw new IllegalArgumentException( "plugin missing" );
} }
return createRealm( getKey( plugin, false ), parent, imports ); return createRealm( getKey( plugin, false ), parent, imports, true );
} }
private String getKey( Plugin plugin, boolean extension ) private String getKey( Plugin plugin, boolean extension )