Skip to Content.
Sympa Menu

notify-dpml - r1506 - in trunk/main: central/src/docs/metro/directives/component/context lang/component/etc metro/runtime/src/main/net/dpml/metro/builder metro/runtime/src/main/net/dpml/metro/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: r1506 - in trunk/main: central/src/docs/metro/directives/component/context lang/component/etc metro/runtime/src/main/net/dpml/metro/builder metro/runtime/src/main/net/dpml/metro/runtime
  • Date: Wed, 7 Jun 2006 16:02:30 +0200

Author: mcconnell
Date: 2006-06-07 16:02:03 +0200 (Wed, 07 Jun 2006)
New Revision: 1506

Modified:
trunk/main/central/src/docs/metro/directives/component/context/entries.xml
trunk/main/central/src/docs/metro/directives/component/context/index.xml
trunk/main/lang/component/etc/component.xsd

trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java

trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
Log:
correct documentation concerning params in component context entries and add
documentation concerning components in a context directive

Modified:
trunk/main/central/src/docs/metro/directives/component/context/entries.xml
===================================================================
---
trunk/main/central/src/docs/metro/directives/component/context/entries.xml
2006-06-06 18:54:10 UTC (rev 1505)
+++
trunk/main/central/src/docs/metro/directives/component/context/entries.xml
2006-06-07 14:02:03 UTC (rev 1506)
@@ -78,10 +78,10 @@

<table>
<tr>
- <td><tt><a href="values.html">value</a></tt></td>
- <td>The entry element may contain 0..n nested &lt;value&gt;
directives.
- A value directive allows in-line construction of operation
parameters,
- array entries, or constructor arguments. Nested values may
not be used in
+ <td><tt><a href="values.html">param</a></tt></td>
+ <td>The entry element may contain 0..n nested &lt;param&gt;
directives.
+ A param directive allows in-line construction of operation
parameters,
+ array entries, or constructor arguments. Nested params may
not be used in
conjunction with the entry <tt>lookup</tt> or <tt>value</tt>
attributes.</td>
</tr>

Modified:
trunk/main/central/src/docs/metro/directives/component/context/index.xml
===================================================================
--- trunk/main/central/src/docs/metro/directives/component/context/index.xml
2006-06-06 18:54:10 UTC (rev 1505)
+++ trunk/main/central/src/docs/metro/directives/component/context/index.xml
2006-06-07 14:02:03 UTC (rev 1506)
@@ -35,6 +35,11 @@
A entry directive allows the creation by (value or reference)
of
a value associated with a context entry key.</td>
</tr>
+ <tr>
+ <td><tt><a href="../index.html">component</a></tt></td>
+ <td>The entry element may also contain 0..n nested
&lt;component&gt; directives
+ representing inline context entry solutions.</td>
+ </tr>
</table>

</subsection>

Modified: trunk/main/lang/component/etc/component.xsd
===================================================================
--- trunk/main/lang/component/etc/component.xsd 2006-06-06 18:54:10 UTC (rev
1505)
+++ trunk/main/lang/component/etc/component.xsd 2006-06-07 14:02:03 UTC (rev
1506)
@@ -51,6 +51,7 @@
<complexType name="ContextType">
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="this:entry"/>
+ <element name="component" type="this:TaggedComponent" minOccurs="0"
maxOccurs="unbounded"/>
</choice>
</complexType>


Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-06-06 18:54:10 UTC (rev 1505)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentDecoder.java
2006-06-07 14:02:03 UTC (rev 1506)
@@ -236,7 +236,7 @@
}
}

- private ContextDirective getNestedContextDirective( Element root )
+ private ContextDirective getNestedContextDirective( Element root )
throws DecodingException
{
Element context = ElementHelper.getChild( root, "context" );
if( null == context )
@@ -249,7 +249,7 @@
}
}

- private ContextDirective createContextDirective( Element element )
+ private ContextDirective createContextDirective( Element element )
throws DecodingException
{
String classname = ElementHelper.getAttribute( element, "class" );
Element[] children = ElementHelper.getChildren( element );
@@ -262,7 +262,7 @@
return new ContextDirective( classname, entries );
}

- private PartReference createContextEntryPartReference( Element element )
+ private PartReference createContextEntryPartReference( Element element )
throws DecodingException
{
String key = ElementHelper.getAttribute( element, "key" );
String spec = ElementHelper.getAttribute( element, "lookup" );
@@ -273,8 +273,23 @@
}
else
{
- ValueDirective directive = buildValueDirective( element );
- return new PartReference( key, directive );
+ String name = element.getTagName();
+ if( "entry".equals( name ) )
+ {
+ ValueDirective directive = buildValueDirective( element );
+ return new PartReference( key, directive );
+ }
+ else if( "component".equals( name ) )
+ {
+ ComponentDirective directive = createComponentDirective(
element );
+ return new PartReference( key, directive );
+ }
+ else
+ {
+ final String error =
+ "Context entry element is not recognized.";
+ throw new DecodingException( element, error );
+ }
}
}


Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-06-06 18:54:10 UTC (rev 1505)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-06-07 14:02:03 UTC (rev 1506)
@@ -382,6 +382,11 @@
LookupDirective value = (LookupDirective) directive;
writeLookupEntry( writer, key, value, pad );
}
+ else if( directive instanceof ComponentDirective )
+ {
+ ComponentDirective value = (ComponentDirective) directive;
+ writeTaggedComponent( writer, value, key, pad );
+ }
else
{
String classname = directive.getClass().getName();

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-06-06 18:54:10 UTC (rev 1505)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-06-07 14:02:03 UTC (rev 1506)
@@ -615,6 +615,32 @@
throw new ControllerException( error, ee );
}
}
+ else if( directive instanceof ComponentDirective )
+ {
+ ClassLoader classloader = handler.getClassLoader();
+ ComponentDirective componentDirective =
(ComponentDirective) directive;
+ Classpath classpath = new Classpath();
+ String partition = handler.getPath();
+ ComponentModel componentModel =
+ createComponentModel( classloader, classpath,
partition, componentDirective );
+ try
+ {
+ Component component = m_controller.createComponent(
componentModel );
+ return component.getProvider().getValue( false );
+ }
+ catch( Exception ee )
+ {
+ final String error =
+ "Unable to resolve context entry component
directive ["
+ + componentDirective
+ + "] requested in component ["
+ + handler.getPath()
+ + "] under the context key ["
+ + key
+ + "].";
+ throw new ControllerException( error, ee );
+ }
+ }
else
{
final String error =

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-06-06 18:54:10 UTC (rev 1505)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-06-07 14:02:03 UTC (rev 1506)
@@ -158,6 +158,11 @@
*/
public ClassLoader getClassLoader( ClassLoader anchor, Classpath
classpath ) throws IOException
{
+ if( null == classpath )
+ {
+ return anchor;
+ }
+
ClassLoader management = ComponentDirective.class.getClassLoader();

ClassLoader composer =
@@ -212,45 +217,6 @@
}
}

- /**
- * Instantiate a value.
- * @param anchor the anchor classloader
- * @param classpath the part classpath definition
- * @param data the part deployment data
- * @param args supplimentary arguments
- * @return the instantiated service
- * @exception Exception if a deployment error occurs
- */
- /*
- public Object getInstance(
- ClassLoader anchor, Classpath classpath, Object data, Object[] args )
throws Exception
- {
- if( data instanceof ComponentDirective )
- {
- ComponentDirective directive = (ComponentDirective) data;
- ComponentModel model = m_controller.createComponentModel(
classpath, directive );
- ClassLoader classloader = getClassLoader( anchor, classpath );
- Component component =
m_controller.createDefaultComponentHandler( classloader, model, true );
- return component.getProvider().getValue( true );
- }
- else
- {
- final String datatype = data.getClass().getName();
- final String error =
- "Datatype not recognized."
- + "\nClass: " + datatype;
- final String report =
- error
- + "\n"
- + StandardClassLoader.toString(
- ComponentDirective.class.getClassLoader(),
- data.getClass().getClassLoader() );
- getLogger().error( report );
- throw new IllegalArgumentException( error );
- }
- }
- */
-
//--------------------------------------------------------------------
// Controller
//--------------------------------------------------------------------




  • r1506 - in trunk/main: central/src/docs/metro/directives/component/context lang/component/etc metro/runtime/src/main/net/dpml/metro/builder metro/runtime/src/main/net/dpml/metro/runtime, mcconnell at BerliOS, 06/07/2006

Archive powered by MHonArc 2.6.24.

Top of Page