Skip to Content.
Sympa Menu

notify-dpml - r1294 - in trunk/main: central/src/docs/about/download depot/library/src/main/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: r1294 - in trunk/main: central/src/docs/about/download depot/library/src/main/net/dpml/library/impl
  • Date: Thu, 30 Mar 2006 07:51:52 +0200

Author: mcconnell
Date: 2006-03-30 07:51:39 +0200 (Thu, 30 Mar 2006)
New Revision: 1294

Modified:
trunk/main/central/src/docs/about/download/archive.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
Log:
add support for nested module export

Modified: trunk/main/central/src/docs/about/download/archive.xml
===================================================================
--- trunk/main/central/src/docs/about/download/archive.xml 2006-03-30
05:06:03 UTC (rev 1293)
+++ trunk/main/central/src/docs/about/download/archive.xml 2006-03-30
05:51:39 UTC (rev 1294)
@@ -27,6 +27,7 @@
<li>Improvements to the metro commandline handler cli options.</li>
<li>Addition of a documentation detailing the specifications for
part and component XML documents.</li>
<li>Build-time valiation of artifact link references.</li>
+ <li>Includes support for module merging and nested module
export.</li>
</ul>

<table>

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-03-30 05:06:03 UTC (rev 1293)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-03-30 05:51:39 UTC (rev 1294)
@@ -464,14 +464,6 @@
DefaultResource getDefaultResource( String ref )
{
return m_module.getDefaultResource( ref );
- //try
- //{
- // return m_module.getDefaultResource( ref );
- //}
- //catch( InvalidNameException e )
- //{
- // return m_imports.getDefaultResource( ref );
- //}
}

/**
@@ -482,14 +474,6 @@
DefaultModule getDefaultModule( String ref )
{
return m_module.getDefaultModule( ref );
- //try
- //{
- // return m_module.getDefaultModule( ref );
- //}
- //catch( InvalidNameException e )
- //{
- // return m_imports.getDefaultModule( ref );
- //}
}


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

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-03-30 05:06:03 UTC (rev 1293)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-03-30 05:51:39 UTC (rev 1294)
@@ -331,18 +331,50 @@
"Cannot export from the virtual root.";
throw new UnsupportedOperationException( error );
}
- if( null != getDefaultParent() )
+
+ DefaultModule parent = getDefaultParent();
+ if( null == parent )
{
- String path = getResourcePath();
- final String error =
- "Illegal attempt to export a nested module."
- + "\nModule: " + path;
- throw new IllegalArgumentException( error );
+ //
+ // exporting a top-level module
+ //
+
+ return (ModuleDirective) exportResource( this );
}
- return (ModuleDirective) exportResource( this );
+ else
+ {
+ //
+ // exporting the nested module
+ //
+
+ ModuleDirective directive = (ModuleDirective) exportResource(
this );
+ return parent.createWrappedDirective( directive );
+ }
}

/**
+ * When exporting a sub-module we need to wrap the submodule in module
+ * directives of the enclosing modules. This method handles this
recusive
+ * wrapping function.
+ * @param directive the directive to wrap
+ * @return a top-level module directive containing the wrapped resource
+ */
+ private ModuleDirective createWrappedDirective( ResourceDirective
directive )
+ {
+ String name = getName();
+ DefaultModule parent = getDefaultParent();
+ if( null == parent )
+ {
+ return new ModuleDirective( name, directive );
+ }
+ else
+ {
+ ModuleDirective module = new ModuleDirective( name, directive );
+ return parent.createWrappedDirective( module );
+ }
+ }
+
+ /**
* Return a directive suitable for publication as an external description.
* @param module the enclosing module
* @return the resource directive




  • r1294 - in trunk/main: central/src/docs/about/download depot/library/src/main/net/dpml/library/impl, mcconnell at BerliOS, 03/30/2006

Archive powered by MHonArc 2.6.24.

Top of Page