Skip to Content.
Sympa Menu

notify-dpml - r1544 - in trunk/main/depot: build/src/main/net/dpml/library/console library/src/main/net/dpml/library/impl library/src/main/net/dpml/library/info library/src/test/net/dpml/library/impl

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1544 - in trunk/main/depot: build/src/main/net/dpml/library/console library/src/main/net/dpml/library/impl library/src/main/net/dpml/library/info library/src/test/net/dpml/library/impl
  • Date: Thu, 13 Jul 2006 04:51:23 +0200

Author: mcconnell
Date: 2006-07-13 04:51:16 +0200 (Thu, 13 Jul 2006)
New Revision: 1544

Modified:
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java

trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java

trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java

trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java

trunk/main/depot/library/src/test/net/dpml/library/impl/AnonymousTestCase.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
Log:
resolve issue related to module dependencies

Modified:
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
===================================================================
---
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/build/src/main/net/dpml/library/console/BuilderPlugin.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -350,7 +350,7 @@
private void listModule( Module module ) throws Exception
{
print( "Listing module [" + module.getResourcePath() + "]\n" );
- listModule( " ", module, 0 );
+ listResource( " ", module, 0 );
print( "" );
}

@@ -373,6 +373,7 @@
print( "" );
}

+ /*
private void listModule( String pad, Module module, int n ) throws
Exception
{
if( n > 0 )
@@ -419,6 +420,7 @@
}
}
}
+ */

private void listResource( String pad, Resource resource, int n ) throws
Exception
{
@@ -443,31 +445,35 @@
print( p + types[i].getID() );
}
}
- Resource[] resources = resource.getProviders( Scope.BUILD, true,
true );
+
+ Resource[] resources = resource.getProviders( Scope.BUILD, false,
true );
if( resources.length > 0 )
{
print( pad + "build phase providers: (" + resources.length + ")"
);
for( int i=0; i<resources.length; i++ )
{
- print( p + resources[i] );
+ Resource res = resources[i];
+ print( p + res );
}
}
- resources = resource.getProviders( Scope.RUNTIME, true, true );
+ resources = resource.getProviders( Scope.RUNTIME, false, true );
if( resources.length > 0 )
{
print( pad + "runtime providers: (" + resources.length + ")" );
for( int i=0; i<resources.length; i++ )
{
- print( p + resources[i] );
+ Resource res = resources[i];
+ print( p + res );
}
}
- resources = resource.getProviders( Scope.TEST, true, true );
+ resources = resource.getProviders( Scope.TEST, false, true );
if( resources.length > 0 )
{
print( pad + "test providers: (" + resources.length + ")" );
for( int i=0; i<resources.length; i++ )
{
- print( p + resources[i] );
+ Resource res = resources[i];
+ print( p + res );
}
}
}

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -66,7 +66,7 @@
* @param library the library
* @param directive the library directive from which common properties
are established
*/
- DefaultModule( DefaultLibrary library, AbstractDirective directive )
+ DefaultModule( final DefaultLibrary library, final AbstractDirective
directive )
{
super( library, directive );

@@ -81,7 +81,8 @@
* @param module the parent module
* @param directive the library directive from which common properties
are established
*/
- DefaultModule( DefaultLibrary library, DefaultModule module,
ModuleDirective directive )
+ DefaultModule(
+ final DefaultLibrary library, final DefaultModule module, final
ModuleDirective directive )
throws DuplicateKeyException
{
super( library, module, directive );
@@ -101,7 +102,7 @@
* @param directive the resource directive to add to the module
* @throws DuplicateKeyException if a resource name is already bound
*/
- DefaultResource addResource( ResourceDirective directive ) throws
DuplicateKeyException
+ DefaultResource addResource( final ResourceDirective directive ) throws
DuplicateKeyException
{
if( null == directive )
{
@@ -117,8 +118,6 @@
{
DefaultModule module = (DefaultModule) m_map.get( key );

- // update properties?
-
// check basedir values

if( null != directive.getBasedir() )
@@ -229,7 +228,7 @@
* @return the resource array
* @exception ResourceNotFoundException if the resource does not exist
*/
- public Resource getResource( String ref ) throws
ResourceNotFoundException
+ public Resource getResource( final String ref ) throws
ResourceNotFoundException
{
try
{
@@ -260,7 +259,7 @@
* @return the module array
* @exception ModuleNotFoundException if the module does not exist
*/
- public Module getModule( String ref ) throws ModuleNotFoundException
+ public Module getModule( final String ref ) throws
ModuleNotFoundException
{
try
{
@@ -296,7 +295,7 @@
* otherwise the array will be sorted alphanumerically
* @return an array of resources matching the selection criteria
*/
- public Resource[] select( String criteria, boolean local, boolean sort )
+ public Resource[] select( final String criteria, final boolean local,
final boolean sort )
{
DefaultResource[] resources = selectDefaultResources( local,
criteria );
if( sort )
@@ -317,7 +316,7 @@
* @return a resource with a matching basedir
* @exception ResourceNotFoundException if resource match relative to
the supplied base
*/
- public Resource locate( File base ) throws ResourceNotFoundException
+ public Resource locate( final File base ) throws
ResourceNotFoundException
{
DefaultResource[] resources = selectDefaultResources( true, "**/*" );
for( int i=0; i<resources.length; i++ )
@@ -372,7 +371,7 @@
* @param directive the directive to wrap
* @return a top-level module directive containing the wrapped resource
*/
- private ModuleDirective createWrappedDirective( ResourceDirective
directive )
+ private ModuleDirective createWrappedDirective( final ResourceDirective
directive )
{
String name = getName();
DefaultModule parent = getDefaultParent();
@@ -393,7 +392,7 @@
* @return the resource directive
* @exception IllegalArgumentException if the module is not a top-level
module
*/
- ResourceDirective exportResource( DefaultModule module ) throws
IllegalArgumentException
+ ResourceDirective exportResource( final DefaultModule module ) throws
IllegalArgumentException
{
DefaultResource[] resources = getDefaultResources();
ResourceDirective[] directives = new ResourceDirective[
resources.length ];
@@ -425,37 +424,26 @@
*/
public String toString()
{
- return "module:" + getResourcePath();
+ return toString( "module" );
}


//----------------------------------------------------------------------------
// DefaultResource (overriding)

//----------------------------------------------------------------------------

- DefaultResource[] getLocalDefaultProviders( Scope scope, Category
category )
+ DefaultResource[] getLocalDefaultProviders( final Scope scope, final
Category category )
{
- if( Scope.BUILD.equals( scope ) )
+ DefaultResource[] local = super.getLocalDefaultProviders( scope,
category );
+ if( Scope.RUNTIME.equals( scope ) )
{
ArrayList stack = new ArrayList();
- DefaultResource[] local = super.getLocalDefaultProviders( scope,
category );
for( int i=0; i<local.length; i++ )
{
DefaultResource resource = local[i];
stack.add( resource );
}
- return getLocalDefaultProviders( stack, true );
- }
- else
- {
- return super.getLocalDefaultProviders( scope, category );
- }
- }
-
- DefaultResource[] getLocalDefaultProviders( List stack, boolean flag )
- {
- DefaultResource[] resources = getDefaultResources();
- if( flag )
- {
+
+ DefaultResource[] resources = getDefaultResources();
for( int i=0; i<resources.length; i++ )
{
DefaultResource resource = resources[i];
@@ -464,14 +452,25 @@
stack.add( resource );
}
}
+
+ return expandLocalDefaultProviders( stack );
}
+ else
+ {
+ return local;
+ }
+ }
+
+ DefaultResource[] expandLocalDefaultProviders( final List stack )
+ {
+ DefaultResource[] resources = getDefaultResources();
for( int i=0; i<resources.length; i++ )
{
DefaultResource resource = resources[i];
if( resource instanceof DefaultModule )
{
DefaultModule module = (DefaultModule) resource;
- DefaultResource[] providers =
module.getLocalDefaultProviders( stack, false );
+ DefaultResource[] providers =
module.expandLocalDefaultProviders( stack );
for( int j=0; j<providers.length; j++ )
{
DefaultResource r = providers[j];
@@ -491,7 +490,7 @@
return (DefaultResource[]) stack.toArray( new DefaultResource[0] );
}

- private void getParentModules( List stack, DefaultResource[] resources )
+ private void getParentModules( final List stack, final DefaultResource[]
resources )
{
for( int i=0; i<resources.length; i++ )
{
@@ -506,16 +505,18 @@
}
}
}
-
+
void sortDefaultResource(
- List visited, List stack, Scope scope, DefaultResource[] resources )
+ final List visited, final List stack, final Scope scope, final
DefaultResource[] resources )
{
if( visited.contains( this ) )
{
return;
}
+
visited.add( this );
- DefaultModule[] providers = getProviderModules( scope );
+ DefaultResource[] providers =
+ getAggregatedDefaultProviders( scope, false, false );
for( int i=0; i<providers.length; i++ )
{
DefaultResource provider = providers[i];
@@ -524,16 +525,21 @@
provider.sortDefaultResource( visited, stack, scope,
resources );
}
}
- DefaultResource[] children = getDefaultResources();
- for( int i=0; i<children.length; i++ )
+
+ DefaultModule[] modules = getProviderModules( scope );
+ for( int i=0; i<modules.length; i++ )
{
- DefaultResource child = children[i];
- if( isaMember( resources, child ) )
+ DefaultResource module = modules[i];
+ if( isaMember( resources, module ) )
{
- child.sortDefaultResource( visited, stack, scope, resources
);
+ module.sortDefaultResource( visited, stack, scope, resources
);
}
}
- stack.add( this );
+
+ if( !stack.contains( this ) )
+ {
+ stack.add( this );
+ }
}


//----------------------------------------------------------------------------
@@ -554,7 +560,7 @@
return (DefaultResource[]) m_map.values().toArray( new
DefaultResource[0] );
}

- DefaultResource getDefaultResource( String ref )
+ DefaultResource getDefaultResource( final String ref )
{
if( null == ref )
{
@@ -589,7 +595,7 @@
}
}

- DefaultModule getDefaultModule( String ref )
+ DefaultModule getDefaultModule( final String ref )
{
if( null == ref )
{
@@ -662,7 +668,7 @@
return getAllDefaultModules( true, false );
}

- DefaultModule[] getAllDefaultModules( boolean sort, boolean self )
+ DefaultModule[] getAllDefaultModules( final boolean sort, final boolean
self )
{
if( sort )
{
@@ -688,7 +694,7 @@
}

private void collectChildModules(
- List visited, List stack, DefaultModule module )
+ final List visited, final List stack, final DefaultModule module )
{
if( visited.contains( module ) )
{
@@ -707,12 +713,12 @@
// Selection logic

//----------------------------------------------------------------------------

- DefaultResource[] selectDefaultResources( String spec )
+ DefaultResource[] selectDefaultResources( final String spec )
{
return selectDefaultResources( false, spec );
}

- DefaultResource[] selectDefaultResources( boolean local, String spec )
+ DefaultResource[] selectDefaultResources( final boolean local, final
String spec )
{
DefaultResource[] resources = doSelectDefaultResources( false, spec
);
if( local )
@@ -725,7 +731,7 @@
}
}

- DefaultResource[] doSelectDefaultResources( boolean wild, String spec )
+ DefaultResource[] doSelectDefaultResources( final boolean wild, final
String spec )
{
String[] tokens = spec.split( "/" );
if( tokens.length == 0 )
@@ -779,7 +785,7 @@
}
}

- DefaultModule[] selectDefaultModules( String token )
+ DefaultModule[] selectDefaultModules( final String token )
{
if( "**".equals( token ) )
{
@@ -803,7 +809,7 @@
}
}

- private DefaultResource[] selectUsingPattern( DefaultResource[]
resources, Pattern pattern )
+ private DefaultResource[] selectUsingPattern( final DefaultResource[]
resources, final Pattern pattern )
{
ArrayList list = new ArrayList();
for( int i=0; i<resources.length; i++ )
@@ -820,13 +826,13 @@
return (DefaultResource[]) list.toArray( new DefaultResource[0] );
}

- private String getRemainderOfSelection( String spec, String delimiter,
String token )
+ private String getRemainderOfSelection( final String spec, final String
delimiter, final String token )
{
int n = token.length() + delimiter.length();
return spec.substring( n );
}

- private void aggregate( List list, DefaultResource[] resources )
+ private void aggregate( final List list, final DefaultResource[]
resources )
{
for( int i=0; i<resources.length; i++ )
{
@@ -834,7 +840,7 @@
}
}

- private Pattern createSelectionPattern( String token )
+ private Pattern createSelectionPattern( final String token )
{
StringBuffer buffer = new StringBuffer();
boolean wildcard = ( token.indexOf( "*" ) > -1 );
@@ -868,7 +874,7 @@
// Module sorting

//----------------------------------------------------------------------------

- private DefaultModule[] sortDefaultModules( DefaultModule[] modules )
+ private DefaultModule[] sortDefaultModules( final DefaultModule[]
modules )
{
Scope scope = Scope.TEST;
ArrayList visited = new ArrayList();
@@ -876,7 +882,6 @@
for( int i=0; i<modules.length; i++ )
{
DefaultModule module = modules[i];
- //processDefaultModule( visited, stack, module, modules );
module.sortDefaultResource( visited, stack, scope, modules );
}
return (DefaultModule[]) stack.toArray( new DefaultModule[0] );
@@ -889,7 +894,7 @@
* this module, and (c) module referenced by any resources contained
within
* this or any subsidiary module.
*/
- private DefaultModule[] getProviderModules( Scope scope )
+ private DefaultModule[] getProviderModules( final Scope scope )
{
ArrayList visited = new ArrayList();
ArrayList stack = new ArrayList();
@@ -897,14 +902,16 @@
return (DefaultModule[]) stack.toArray( new DefaultModule[0] );
}

- private void processModuleDependencies( List visited, List stack, Scope
scope, DefaultResource resource )
+ private void processModuleDependencies(
+ final List visited, final List stack, final Scope scope, final
DefaultResource resource )
{
if( visited.contains( resource ) )
{
return;
}
+
visited.add( resource );
- final boolean expansion = true;
+ final boolean expansion = false;
final boolean filtering = false;

Classifier classifier = resource.getClassifier();
@@ -943,7 +950,7 @@
}
}

- private DefaultResource[] filterProjects( DefaultResource[] resources )
+ private DefaultResource[] filterProjects( final DefaultResource[]
resources )
{
ArrayList list = new ArrayList();
for( int i=0; i<resources.length; i++ )

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultResource.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -94,7 +94,7 @@
* @param library the reference library
* @param directive the directive
*/
- DefaultResource( DefaultLibrary library, AbstractDirective directive )
+ DefaultResource( final DefaultLibrary library, final AbstractDirective
directive )
{
super( null, directive );

@@ -115,7 +115,8 @@
* @param module the parent module
* @param directive the resource directive
*/
- DefaultResource( DefaultLibrary library, DefaultModule module,
ResourceDirective directive )
+ DefaultResource(
+ final DefaultLibrary library, final DefaultModule module, final
ResourceDirective directive )
{
super( module, directive );
if( null == directive )
@@ -340,7 +341,7 @@
* @param type the type id
* @return TRUE if this resource produces an artifact of the supplied type
*/
- public boolean isa( String type )
+ public boolean isa( final String type )
{
for( int i=0; i<m_types.length; i++ )
{
@@ -361,7 +362,7 @@
* @exception IllegalArgumentException if the id value does not match
* a type produced by the resource.
*/
- public Type getType( String id ) throws IllegalArgumentException
+ public Type getType( final String id ) throws IllegalArgumentException
{
for( int i=0; i<m_types.length; i++ )
{
@@ -385,7 +386,7 @@
* @param id the resource type id
* @return the link artifact
*/
- public Artifact getLinkArtifact( String id )
+ public Artifact getLinkArtifact( final String id )
{
if( null == m_directive )
{
@@ -446,7 +447,7 @@
* @param id the resource type identifier
* @return the artifact
*/
- public Artifact getArtifact( String id )
+ public Artifact getArtifact( final String id )
{
if( null == m_directive )
{
@@ -536,7 +537,7 @@
* @param ref the uri argument
* @return the uri value
*/
- public URI toURI( String ref ) throws URISyntaxException
+ public URI toURI( final String ref ) throws URISyntaxException
{
Artifact spec = Artifact.createArtifact( ref );
if( spec.isRecognized() )
@@ -600,7 +601,7 @@
* @param sort if true the array will sorted relative to dependencies
* @return the resource providers
*/
- public Resource[] getProviders( Scope scope, boolean expand, boolean
sort )
+ public Resource[] getProviders( final Scope scope, final boolean expand,
final boolean sort )
{
return getDefaultProviders( scope, expand, sort );
}
@@ -617,7 +618,7 @@
* @param sort if true the array will sorted relative to dependencies
* @return the resource providers
*/
- public Resource[] getAggregatedProviders( Scope scope, boolean expand,
boolean sort )
+ public Resource[] getAggregatedProviders( final Scope scope, final
boolean expand, final boolean sort )
{
return getAggregatedDefaultProviders( scope, expand, sort, false );
}
@@ -631,11 +632,11 @@
* @param scope the aggregation scope
* @return the scoped resource chain
*/
- public Resource[] getClasspathProviders( Scope scope )
+ public Resource[] getClasspathProviders( final Scope scope )
{
- boolean expanded = true;
- boolean sorted = true;
- boolean filtered = true;
+ final boolean expanded = true;
+ final boolean sorted = true;
+ final boolean filtered = true;
return getAggregatedDefaultProviders( scope, expanded, sorted,
filtered );
}

@@ -651,7 +652,7 @@
* @param category the classloader category
* @return the category scoped resource chain
*/
- public Resource[] getClasspathProviders( Category category )
+ public Resource[] getClasspathProviders( final Category category )
{
DefaultResource[] resources = getClasspathDefaultProviders( category
);
return sortDefaultResources( resources, Scope.RUNTIME );
@@ -665,7 +666,7 @@
* @param sort if true the array is sorted relative to depenency
relationships
* @return the array of consumer projects
*/
- public Resource[] getConsumers( boolean expand, boolean sort )
+ public Resource[] getConsumers( final boolean expand, final boolean sort
)
{
return getDefaultConsumers( expand, sort );
}
@@ -684,7 +685,7 @@
* @param id the artifact type
* @return the filename
*/
- public String getLayoutPath( String id )
+ public String getLayoutPath( final String id )
{
Artifact artifact = getArtifact( id );
return Transit.getInstance().getCacheLayout().resolveFilename(
artifact );
@@ -695,7 +696,7 @@
* @param module the enclosing module
* @return the resource directive
*/
- ResourceDirective exportResource( DefaultModule module )
+ ResourceDirective exportResource( final DefaultModule module )
{
if( null == m_directive )
{
@@ -716,7 +717,7 @@
info, exportedTypes, dependencies, properties, null );
}

- TypeDirective[] createExportedTypes( TypeDirective[] types )
+ TypeDirective[] createExportedTypes( final TypeDirective[] types )
{
TypeDirective[] export = new TypeDirective[ types.length ];
for( int i=0; i<export.length; i++ )
@@ -729,7 +730,7 @@
return export;
}

- private DependencyDirective[] createDeps( DefaultModule module )
+ private DependencyDirective[] createDeps( final DefaultModule module )
{
ArrayList list = new ArrayList();
createIncludeDirectives( module, list, Category.SYSTEM );
@@ -750,7 +751,7 @@
}
}

- boolean isaDescendant( DefaultModule module )
+ boolean isaDescendant( final DefaultModule module )
{
if( module == this )
{
@@ -773,7 +774,8 @@
}
}

- private void createIncludeDirectives( DefaultModule module, List list,
Category category )
+ private void createIncludeDirectives(
+ final DefaultModule module, final List list, final Category category )
{
DefaultResource[] providers =
getDefaultProviders( Scope.RUNTIME, true, category );
@@ -835,7 +837,7 @@
return toString( "resource" );
}

- private String toString( String type )
+ String toString( final String type )
{
return type + ":" + getResourcePath() + "#" + getVersion();
}
@@ -845,7 +847,7 @@
* @param other the other object
* @return the comparitive index
*/
- public int compareTo( Object other )
+ public int compareTo( final Object other )
{
if( other instanceof DefaultResource )
{
@@ -902,7 +904,7 @@
}

DefaultResource[] getAggregatedDefaultProviders(
- Scope scope, boolean expanded, boolean sort, boolean filtered )
+ final Scope scope, final boolean expanded, final boolean sort, final
boolean filtered )
{
DefaultResource[] resources =
getAggregatedDefaultProviders( scope, expanded, filtered );
@@ -917,48 +919,65 @@
}
}

- DefaultResource[] getAggregatedDefaultProviders( Scope scope, boolean
expanded, boolean filtered )
+ DefaultResource[] getAggregatedDefaultProviders(
+ final Scope scope, final boolean expanded, final boolean filtered )
{
ArrayList list = new ArrayList();
if( !filtered )
{
- aggregateProviders( list, Scope.BUILD, expanded, filtered );
+ aggregateProviders( list, Scope.BUILD );
}
if( scope.isGreaterThan( Scope.BUILD ) )
{
- aggregateProviders( list, Scope.RUNTIME, expanded, filtered );
+ aggregateProviders( list, Scope.RUNTIME );
}
if( scope.isGreaterThan( Scope.RUNTIME ) )
{
- aggregateProviders( list, Scope.TEST, expanded, filtered );
+ aggregateProviders( list, Scope.TEST );
}
- return (DefaultResource[]) list.toArray( new DefaultResource[0] );
+ DefaultResource[] result = (DefaultResource[]) list.toArray( new
DefaultResource[0] );
+ if( expanded )
+ {
+ List visited = new ArrayList();
+ List stack = new ArrayList();
+ for( int i=0; i<result.length; i++ )
+ {
+ DefaultResource resource = result[i];
+ processDefaultResource( visited, stack, scope, true,
resource );
+ }
+ result = (DefaultResource[]) stack.toArray( new
DefaultResource[0] );
+ }
+ if( filtered )
+ {
+ List stack = new ArrayList();
+ for( int i=0; i<result.length; i++ )
+ {
+ DefaultResource resource = result[i];
+ if( resource.isa( "jar" ) )
+ {
+ stack.add( resource );
+ }
+ }
+ result = (DefaultResource[]) stack.toArray( new
DefaultResource[0] );
+ }
+ return result;
}

- private void aggregateProviders( List list, Scope scope, boolean
expanded, boolean filter )
+ private void aggregateProviders( final List list, final Scope scope )
{
- DefaultResource[] resources = getDefaultProviders( scope, expanded,
null );
+ DefaultResource[] resources = getDefaultProviders( scope, false,
null );
for( int i=0; i<resources.length; i++ )
{
DefaultResource resource = resources[i];
- if( !filter )
+ if( !list.contains( resource ) )
{
- if( !list.contains( resource ) )
- {
- list.add( resource );
- }
+ list.add( resource );
}
- else if( resource.isa( "jar" ) )
- {
- if( !list.contains( resource ) )
- {
- list.add( resource );
- }
- }
}
}

- DefaultResource[] getDefaultProviders( Scope scope, boolean expanded,
boolean sort )
+ DefaultResource[] getDefaultProviders(
+ final Scope scope, final boolean expanded, final boolean sort )
{
DefaultResource[] resources = getDefaultProviders( scope, expanded,
null );
if( sort )
@@ -972,7 +991,8 @@
}
}

- DefaultResource[] getDefaultProviders( Scope scope, boolean expand,
Category category )
+ DefaultResource[] getDefaultProviders(
+ final Scope scope, final boolean expand, final Category category )
{
ArrayList visited = new ArrayList();
ArrayList stack = new ArrayList();
@@ -989,20 +1009,10 @@
stack.add( provider );
}
}
- if( expand && ( this instanceof DefaultModule ) )
- {
- DefaultModule module = (DefaultModule) this;
- DefaultResource[] children = module.getDefaultResources();
- for( int i=0; i<children.length; i++ )
- {
- DefaultResource child = children[i];
- processDefaultResource( visited, stack, scope, false, child
);
- }
- }
return (DefaultResource[]) stack.toArray( new DefaultResource[0] );
}

- DefaultResource[] getLocalDefaultProviders( Scope scope, Category
category )
+ DefaultResource[] getLocalDefaultProviders( final Scope scope, final
Category category )
{
if( null == m_directive )
{
@@ -1089,7 +1099,7 @@
return resources;
}

- private IncludeDirective[] getLocalIncludes( Scope scope, Category
category )
+ private IncludeDirective[] getLocalIncludes( final Scope scope, final
Category category )
{
DependencyDirective dependency = m_directive.getDependencyDirective(
scope );
if( null == category )
@@ -1103,7 +1113,8 @@
}

private void processDefaultResource(
- List visited, List stack, Scope scope, boolean expand, DefaultResource
resource )
+ final List visited, final List stack, final Scope scope, final boolean
expand,
+ final DefaultResource resource )
{
if( visited.contains( resource ) )
{
@@ -1112,7 +1123,7 @@
else
{
visited.add( resource );
- DefaultResource[] providers =
resource.getAggregatedDefaultProviders( scope, expand, false );
+ DefaultResource[] providers =
resource.getAggregatedDefaultProviders( scope, false, false );
for( int i=0; i<providers.length; i++ )
{
processDefaultResource( visited, stack, scope, expand,
providers[i] );
@@ -1121,7 +1132,7 @@
}
}

- private String getIncludeReference( IncludeDirective directive )
+ private String getIncludeReference( final IncludeDirective directive )
{
if( null == m_parent )
{
@@ -1153,7 +1164,7 @@
// consumer concerns

//----------------------------------------------------------------------------

- boolean isaConsumer( DefaultResource resource )
+ boolean isaConsumer( final DefaultResource resource )
{
DefaultResource[] resources = getAggregatedDefaultProviders(
Scope.TEST, false, false );
for( int i=0; i<resources.length; i++ )
@@ -1167,7 +1178,7 @@
return false;
}

- DefaultResource[] getDefaultConsumers( boolean expand, boolean sort )
+ DefaultResource[] getDefaultConsumers( final boolean expand, final
boolean sort )
{
DefaultResource[] consumers = getDefaultConsumers( expand );
if( sort )
@@ -1180,7 +1191,7 @@
}
}

- DefaultResource[] getDefaultConsumers( boolean expand )
+ DefaultResource[] getDefaultConsumers( final boolean expand )
{
if( !expand )
{
@@ -1210,7 +1221,7 @@
}
}

- void processConsumer( List visited, List stack, DefaultResource consumer
)
+ void processConsumer( final List visited, final List stack, final
DefaultResource consumer )
{
if( visited.contains( consumer ) )
{
@@ -1238,7 +1249,7 @@
* @param category the runtime classloader category
* @return the array of resources the define a classloader for the
category
*/
- private DefaultResource[] getClasspathDefaultProviders( Category
category )
+ private DefaultResource[] getClasspathDefaultProviders( final Category
category )
{
ArrayList list = new ArrayList();
for( int i=0; i<category.getValue(); i++ )
@@ -1270,12 +1281,12 @@
// sorting relative to dependencies

//----------------------------------------------------------------------------

- DefaultResource[] sortDefaultResources( DefaultResource[] resources )
+ DefaultResource[] sortDefaultResources( final DefaultResource[]
resources )
{
return sortDefaultResources( resources, Scope.TEST );
}

- DefaultResource[] sortDefaultResources( DefaultResource[] resources,
Scope scope )
+ DefaultResource[] sortDefaultResources( final DefaultResource[]
resources, final Scope scope )
{
ArrayList visited = new ArrayList();
ArrayList stack = new ArrayList();
@@ -1288,7 +1299,7 @@
}

void sortDefaultResource(
- List visited, List stack, Scope scope, DefaultResource[] resources )
+ final List visited, final List stack, final Scope scope, final
DefaultResource[] resources )
{
if( visited.contains( this ) )
{
@@ -1314,7 +1325,7 @@
}
}

- boolean isaMember( DefaultResource[] resources, DefaultResource resource
)
+ boolean isaMember( final DefaultResource[] resources, final
DefaultResource resource )
{
for( int i=0; i<resources.length; i++ )
{
@@ -1383,7 +1394,7 @@
return m_library.getRootDirectory();
}

- File getCanonicalFile( File file )
+ File getCanonicalFile( final File file )
{
try
{

Modified:
trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/ResourceDirective.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -374,7 +374,6 @@
*/
public DependencyDirective getDependencyDirective( Scope scope )
{
- ArrayList list = new ArrayList();
for( int i=0; i<m_dependencies.length; i++ )
{
DependencyDirective directive = m_dependencies[i];

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/AbstractTestCase.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -146,7 +146,7 @@
else
{
System.out.println( "PATH: " + path + " " + expand + ", " + sort
- + "("
+ + " ("
+ buildProviders.length + ", "
+ runtimeProviders.length
+ ", " + testProviders.length

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/AnonymousTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/AnonymousTestCase.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/AnonymousTestCase.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -68,20 +68,9 @@
public void testExpandedAnonymousModuleProviders() throws Exception
{
Module module = (Module) getLibrary().getResource( "demo" );
- Resource[] providers = module.getAggregatedProviders( Scope.RUNTIME,
true, false );
+ boolean expanded = true;
+ boolean sorted = false;
+ Resource[] providers = module.getAggregatedProviders( Scope.RUNTIME,
expanded, sorted );
assertEquals( "expanded-providers", 2, providers.length );
- boolean test = false;
- for( int i=0; i<providers.length; i++ )
- {
- Resource provider = providers[i];
- if( provider.getResourcePath().equals(
"commons-collections/commons-collections" ) )
- {
- test = true;
- }
- }
- if( !test )
- {
- fail( "Missing commons-collection dynamic dependency." );
- }
}
}

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -122,8 +122,8 @@
try
{
String path = "dpml";
- doProviderTest( path, false, 9, 0, 0 );
- doProviderTest( path, true, 39, 39, 39 );
+ doProviderTest( path, false, 0, 9, 0 );
+ doProviderTest( path, true, 0, 39, 0 );
}
catch( Exception e )
{
@@ -132,13 +132,15 @@
try
{
String path = "dpml/transit";
- doProviderTest( path, false, 4, 0, 0 );
- doProviderTest( path, true, 8, 4, 6 );
+ doProviderTest( path, false, 0, 4, 0 );
+ doProviderTest( path, true, 0, 8, 0 );
}
catch( Exception e )
{
throw e;
}
+ /* issue
+ */
/*try
{
String path = "dpml/metro";

Modified:
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
===================================================================
---
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
2006-07-12 16:39:37 UTC (rev 1543)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultResourceTestCase.java
2006-07-13 02:51:16 UTC (rev 1544)
@@ -255,7 +255,7 @@
Resource[] test = resource.getAggregatedProviders( Scope.TEST, true,
false );
assertEquals( "build", 0, build.length );
assertEquals( "runtime", 12, runtime.length );
- assertEquals( "test", 12, test.length );
+ assertEquals( "test", 16, test.length );
}

/**




  • r1544 - in trunk/main/depot: build/src/main/net/dpml/library/console library/src/main/net/dpml/library/impl library/src/main/net/dpml/library/info library/src/test/net/dpml/library/impl, mcconnell at BerliOS, 07/12/2006

Archive powered by MHonArc 2.6.24.

Top of Page