Skip to Content.
Sympa Menu

notify-dpml - r1870 - trunk/main/metro/part/src/main/net/dpml/runtime

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: r1870 - trunk/main/metro/part/src/main/net/dpml/runtime
  • Date: Sun, 11 Feb 2007 03:47:07 +0100

Author: mcconnell
Date: 2007-02-11 03:47:05 +0100 (Sun, 11 Feb 2007)
New Revision: 1870

Modified:
trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
Log:
update to ensure that a nested context solution is only created if the
context entry either required, or - an optional entry with at least one
sub-entry

Modified: trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
===================================================================
--- trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
2007-02-11 02:45:38 UTC (rev 1869)
+++ trunk/main/metro/part/src/main/net/dpml/runtime/ContextModel.java
2007-02-11 02:47:05 UTC (rev 1870)
@@ -68,7 +68,31 @@
{
ContextDirective parent = getContextDirective( bundled,
key );
ContextDirective nested = getContextDirective(
directive, key );
- value = new ContextModel( clazz, path, c, policy, key,
parent, nested, query );
+ try
+ {
+ ContextModel model = new ContextModel( clazz, path,
c, policy, key, parent, nested, query );
+ if( !optional || ( model.size() > 0 ) )
+ {
+ value = model;
+ }
+ }
+ catch( MissingContextEntryException mcee )
+ {
+ if( !optional )
+ {
+ final String error =
+ "Nested context entry ["
+ + key
+ + "] within the context definition ["
+ + c.getName()
+ + "] as a constructor argument to the
component class ["
+ + clazz.getName()
+ + "] within the component model ["
+ + path
+ + "] could not be created.";
+ throw new ComponentException( error );
+ }
+ }
}
else
{
@@ -102,12 +126,17 @@
+ "] within the component model ["
+ path
+ "].";
- throw new ComponentException( error );
+ throw new MissingContextEntryException( error );
}
}
}
}

+ int size()
+ {
+ return m_map.size();
+ }
+
private String getScopedKey( String base, String key )
{
if( null == base )




  • r1870 - trunk/main/metro/part/src/main/net/dpml/runtime, mcconnell at BerliOS, 02/10/2007

Archive powered by MHonArc 2.6.24.

Top of Page