Skip to Content.
Sympa Menu

notify-dpml - r1595 - in trunk/main: depot/library/etc/data depot/library/src/main/net/dpml/library/impl depot/library/src/main/net/dpml/library/info depot/library/src/test/net/dpml/library/impl lang/module/etc

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: r1595 - in trunk/main: depot/library/etc/data depot/library/src/main/net/dpml/library/impl depot/library/src/main/net/dpml/library/info depot/library/src/test/net/dpml/library/impl lang/module/etc
  • Date: Wed, 19 Jul 2006 17:25:01 +0200

Author: mcconnell
Date: 2006-07-19 17:24:59 +0200 (Wed, 19 Jul 2006)
New Revision: 1595

Modified:
trunk/main/depot/library/etc/data/library.xml
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java

trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
trunk/main/lang/module/etc/module.xsd
Log:
update module xsd and implementation to support resource, project and module
definitions as nested elements within an index

Modified: trunk/main/depot/library/etc/data/library.xml
===================================================================
--- trunk/main/depot/library/etc/data/library.xml 2006-07-19 15:20:09
UTC (rev 1594)
+++ trunk/main/depot/library/etc/data/library.xml 2006-07-19 15:24:59
UTC (rev 1595)
@@ -6,6 +6,8 @@
<property name="project.standard.template"
value="local:template:dpml/tools/standard"/>
<property name="project.template" value="${project.standard.template}"/>
</properties>
+
+ <project name="demo" basedir="."/>

<module file="junit/module.xml"/>
<module file="commons-cli/module.xml"/>

Modified:
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-07-19 15:20:09 UTC (rev 1594)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-07-19 15:24:59 UTC (rev 1595)
@@ -139,28 +139,28 @@

// create the top-level modules

- ArrayList moduleDirectives = new ArrayList();
+ ArrayList primaryDirectives = new ArrayList();
ResourceDirective[] directives = m_directive.getResourceDirectives();
for( int i=0; i<directives.length; i++ )
{
ResourceDirective directive = directives[i];
- if( directive instanceof ModuleDirective )
- {
- ModuleDirective md = (ModuleDirective) directive;
- moduleDirectives.add( md );
- }
- else
- {
- final String error =
- "No support in place for non-module top-level resources.";
- throw new IllegalArgumentException( error );
- }
+ //if( directive instanceof ModuleDirective )
+ //{
+ //ModuleDirective md = (ModuleDirective) directive;
+ primaryDirectives.add( directive );
+ //}
+ //else
+ //{
+ // final String error =
+ // "No support in place for non-module top-level
resources.";
+ // throw new IllegalArgumentException( error );
+ //}
}
- ModuleDirective[] values = (ModuleDirective[])
moduleDirectives.toArray( new ModuleDirective[0] );
+ ResourceDirective[] values = (ResourceDirective[])
primaryDirectives.toArray( new ResourceDirective[0] );
for( int i=0; i<values.length; i++ )
{
- ModuleDirective md = values[i];
- m_module.addResource( md );
+ ResourceDirective d = values[i];
+ m_module.addResource( d );
}
}


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-19 15:20:09 UTC (rev 1594)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-07-19 15:24:59 UTC (rev 1595)
@@ -765,7 +765,7 @@
}
else if( "*".equals( token ) )
{
- if( wild )
+ if( wild && !m_root )
{
DefaultResource[] resources = getDefaultResources();
DefaultResource[] result = new DefaultResource[
resources.length + 1 ];
@@ -799,6 +799,11 @@
DefaultResource[] selection =
module.doSelectDefaultResources( wildcard, remainder );
aggregate( list, selection );
}
+ if( wildcard )
+ {
+ DefaultResource[] selection = doSelectDefaultResources(
wildcard, remainder );
+ aggregate( list, selection );
+ }
return (DefaultResource[]) list.toArray( new DefaultResource[0]
);
}
}
@@ -854,7 +859,11 @@
{
for( int i=0; i<resources.length; i++ )
{
- list.add( resources[i] );
+ DefaultResource resource = resources[i];
+ if( !list.contains( resource ) )
+ {
+ list.add( resources[i] );
+ }
}
}


Modified:
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
===================================================================
---
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
2006-07-19 15:20:09 UTC (rev 1594)
+++
trunk/main/depot/library/src/main/net/dpml/library/info/LibraryDecoder.java
2006-07-19 15:24:59 UTC (rev 1595)
@@ -169,52 +169,17 @@
{
imports = buildImportDirectives( child );
}
- else if( MODULE_ELEMENT_NAME.equals( tag ) )
+ else
{
ResourceDirective resource =
buildResourceDirectiveFromElement( base, child, null );
list.add( resource );
- //resources = expandModulesElement( base, child );
}
- else
- {
- final String error =
- "Illegal element name [" + tag + "] within 'library'
element.";
- throw new IllegalArgumentException( error );
- }
}
ResourceDirective[] resources = (ResourceDirective[]) list.toArray(
new ResourceDirective[0] );
return new LibraryDirective( imports, resources, properties );
}

/**
- * Construct a module directive relative to the supplied base directory
- * using the supplied DOM element.
- * @param base the basedir of the enclosing library or module
- * @param element the element defining the module
- */
- /*
- private ResourceDirective[] expandModulesElement(
- File base, Element element ) throws Exception
- {
- String tag = element.getTagName();
- if( !"modules".equals( element.getTagName() ) )
- {
- final String error =
- "Unsupported library element name [" + tag + "].";
- throw new IllegalArgumentException( error );
- }
- Element[] children = ElementHelper.getChildren( element );
- ResourceDirective[] resources = new ResourceDirective[
children.length ];
- for( int i=0; i<children.length; i++ )
- {
- Element child = children[i];
- resources[i] = buildResourceDirectiveFromElement( base, child,
null );
- }
- return resources;
- }
- */
-
- /**
* Build a resource using an XML element.
* @param base the base directory
* @param element the module element
@@ -294,9 +259,7 @@
final String name = ElementHelper.getAttribute( element, "name"
);

final String version = ElementHelper.getAttribute( element,
"version" );
- String spec = ElementHelper.getAttribute( element, "basedir",
null );
-
- String basedir = spec;
+ String basedir = ElementHelper.getAttribute( element, "basedir",
null );
if( path != null )
{
if( basedir == null )
@@ -314,11 +277,7 @@
classifier = Classifier.LOCAL;
if( null == basedir )
{
- final String error =
- "Missing basedir attribute on project ["
- + name
- + "].";
- throw new DecodingException( element, error );
+ basedir = ".";
}
}
else if( MODULE_ELEMENT_NAME.equals( tag ) )

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-19 15:20:09 UTC (rev 1594)
+++
trunk/main/depot/library/src/test/net/dpml/library/impl/DefaultModuleTestCase.java
2006-07-19 15:24:59 UTC (rev 1595)
@@ -224,7 +224,7 @@
public void testSelectChildren() throws Exception
{
Resource[] resources = getLibrary().select( "*", true );
- assertEquals( "top-level-child-count", 6, resources.length );
+ assertEquals( "top-level-child-count", 7, resources.length );
}

/**
@@ -254,7 +254,7 @@
public void testSelectAll() throws Exception
{
Resource[] resources = getLibrary().select( "**/*", false );
- assertEquals( "'**/*'-selection", 44, resources.length );
+ assertEquals( "'**/*'-selection", 41, resources.length );
}

/**

Modified: trunk/main/lang/module/etc/module.xsd
===================================================================
--- trunk/main/lang/module/etc/module.xsd 2006-07-19 15:20:09 UTC (rev
1594)
+++ trunk/main/lang/module/etc/module.xsd 2006-07-19 15:24:59 UTC (rev
1595)
@@ -6,9 +6,9 @@
elementFormDefault="qualified">

<element name="index" type="this:IndexType"/>
- <element name="module" type="this:ModuleType"/>
- <element name="project" type="this:ProjectType"/>
<element name="resource" type="this:ResourceType"/>
+ <element name="project" type="this:ProjectType"
substitutionGroup="this:resource"/>
+ <element name="module" type="this:ModuleType"
substitutionGroup="this:resource"/>
<element name="property" type="this:PropertyType"/>
<element name="typedef" type="this:AbstractType"/>
<element name="type" type="this:GenericType"
substitutionGroup="this:typedef"/>
@@ -17,7 +17,7 @@
<sequence>
<element name="imports" type="this:ImportsType" minOccurs="0"
maxOccurs="1"/>
<element name="properties" type="this:PropertiesType" minOccurs="0"
maxOccurs="1"/>
- <element name="module" type="this:ModuleType" minOccurs="0"
maxOccurs="unbounded"/>
+ <element ref="this:resource" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>





  • r1595 - in trunk/main: depot/library/etc/data depot/library/src/main/net/dpml/library/impl depot/library/src/main/net/dpml/library/info depot/library/src/test/net/dpml/library/impl lang/module/etc, mcconnell at BerliOS, 07/19/2006

Archive powered by MHonArc 2.6.24.

Top of Page