Skip to Content.
Sympa Menu

notify-dpml - r1293 - trunk/main/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: r1293 - trunk/main/depot/library/src/main/net/dpml/library/impl
  • Date: Thu, 30 Mar 2006 07:06:09 +0200

Author: mcconnell
Date: 2006-03-30 07:06:03 +0200 (Thu, 30 Mar 2006)
New Revision: 1293

Modified:
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:
merge imports and root module into a single root module

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 03:36:02 UTC (rev 1292)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultLibrary.java
2006-03-30 05:06:03 UTC (rev 1293)
@@ -55,7 +55,7 @@

private final LibraryDirective m_directive;
private final DefaultModule m_module;
- private final DefaultModule m_imports;
+ //private final DefaultModule m_imports;
private final File m_root;
private final Logger m_logger;
private final Hashtable m_anonymous = new Hashtable();
@@ -133,11 +133,12 @@
}
}

- m_imports = new DefaultModule( this, m_directive );
+ //m_imports = new DefaultModule( this, m_directive );
for( int i=0; i<importModuleDirectives.length; i++ )
{
ModuleDirective importModuleDirective =
importModuleDirectives[i];
- m_imports.addResource( importModuleDirective );
+ //m_imports.addResource( importModuleDirective );
+ m_module.addResource( importModuleDirective );
}

// create the top-level modules
@@ -212,14 +213,15 @@
*/
public Module getModule( String ref ) throws ModuleNotFoundException
{
- try
- {
- return m_module.getModule( ref );
- }
- catch( ModuleNotFoundException e )
- {
- return m_imports.getModule( ref );
- }
+ return m_module.getModule( ref );
+ //try
+ //{
+ // return m_module.getModule( ref );
+ //}
+ //catch( ModuleNotFoundException e )
+ //{
+ // return m_imports.getModule( ref );
+ //}
}

/**
@@ -230,14 +232,15 @@
*/
public Resource getResource( String ref ) throws
ResourceNotFoundException
{
- try
- {
- return m_module.getResource( ref );
- }
- catch( ResourceNotFoundException e )
- {
- return m_imports.getResource( ref );
- }
+ return m_module.getResource( ref );
+ //try
+ //{
+ // return m_module.getResource( ref );
+ //}
+ //catch( ResourceNotFoundException e )
+ //{
+ // return m_imports.getResource( ref );
+ //}
}

/**
@@ -460,14 +463,15 @@
*/
DefaultResource getDefaultResource( String ref )
{
- try
- {
- return m_module.getDefaultResource( ref );
- }
- catch( InvalidNameException e )
- {
- return m_imports.getDefaultResource( ref );
- }
+ return m_module.getDefaultResource( ref );
+ //try
+ //{
+ // return m_module.getDefaultResource( ref );
+ //}
+ //catch( InvalidNameException e )
+ //{
+ // return m_imports.getDefaultResource( ref );
+ //}
}

/**
@@ -477,14 +481,15 @@
*/
DefaultModule getDefaultModule( String ref )
{
- try
- {
- return m_module.getDefaultModule( ref );
- }
- catch( InvalidNameException e )
- {
- return m_imports.getDefaultModule( 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 03:36:02 UTC (rev 1292)
+++
trunk/main/depot/library/src/main/net/dpml/library/impl/DefaultModule.java
2006-03-30 05:06:03 UTC (rev 1293)
@@ -106,14 +106,60 @@

// update properties?

- // update basedir?
+ // check basedir values

- // update version?
+ if( null != directive.getBasedir() )
+ {
+ if( null != module.getBaseDir() )
+ {
+ File base = new File( getBaseDir(),
directive.getBasedir() );
+ if( !module.getBaseDir().equals( base ) )
+ {
+ final String error =
+ "Cannot merge modules with different base
directories."
+ + "\nModule: " + module
+ + "\nPrimary base: " + module.getBaseDir()
+ + "\nSecondary base: " + base;
+ throw new IllegalStateException( error );
+ }
+ }
+ }

- // update types?
+ // check versions

- // update dependencies?
+ if( null != directive.getVersion() )
+ {
+ if( module.getVersion().equals(
directive.getVersion() ) )
+ {
+ final String error =
+ "Cannot merge modules with different versions."
+ + "\nModule: " + module
+ + "\nPrimary version: " + module.getVersion()
+ + "\nSecondary version: " +
directive.getVersion();
+ throw new IllegalStateException( error );
+ }
+ }

+ // check types
+
+ if( directive.getTypeDirectives().length > 0 )
+ {
+ final String error =
+ "Cannot merge a module with type production
directives."
+ + "\nModule: " + module;
+ throw new IllegalStateException( error );
+ }
+
+ // check dependencies
+
+ if( directive.getDependencyDirectives().length > 0 )
+ {
+ final String error =
+ "Cannot merge a module with dependency directives."
+ + "\nModule: " + module;
+ throw new IllegalStateException( error );
+ }
+
// add additional resources

ModuleDirective d = (ModuleDirective) directive;




  • r1293 - trunk/main/depot/library/src/main/net/dpml/library/impl, mcconnell at BerliOS, 03/30/2006

Archive powered by MHonArc 2.6.24.

Top of Page