Skip to Content.
Sympa Menu

notify-dpml - r1534 - trunk/main/metro/runtime/src/main/net/dpml/metro/builder

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: r1534 - trunk/main/metro/runtime/src/main/net/dpml/metro/builder
  • Date: Mon, 3 Jul 2006 06:35:18 +0200

Author: mcconnell
Date: 2006-07-03 06:35:13 +0200 (Mon, 03 Jul 2006)
New Revision: 1534

Modified:

trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
Log:
add support for XML export of import directives

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-07-03 04:21:51 UTC (rev 1533)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/builder/ComponentEncoder.java
2006-07-03 04:35:13 UTC (rev 1534)
@@ -22,6 +22,7 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.net.URI;

import javax.xml.XMLConstants;

@@ -37,6 +38,8 @@
import net.dpml.metro.data.ComponentDirective;
import net.dpml.metro.data.LookupDirective;
import net.dpml.metro.data.ValueDirective;
+import net.dpml.metro.data.ImportDirective;
+
import net.dpml.metro.info.LifestylePolicy;
import net.dpml.metro.info.CollectionPolicy;
import net.dpml.metro.info.PartReference;
@@ -152,6 +155,24 @@
writer.write( "\n" + pad + "</component>" );
}

+ /**
+ * Export a tagged import directive to an output stream as XML.
+ * @param writer the print writer
+ * @param directive the import directive
+ * @param key the key identifying the component
+ * @param pad character offset
+ * @exception IOException if an IO error occurs
+ */
+ public void writeTaggedImport(
+ Writer writer, ImportDirective directive, String key, String pad )
throws IOException
+ {
+ URI uri = directive.getURI();
+ String spec = uri.toASCIIString();
+ writer.write( "\n" + pad + "<import xmlns=\"" + COMPONENT_SCHEMA_URN
+ "\"" );
+ writer.write( " key=\"" + key + "\"" );
+ writer.write( " uri=\"" + spec + "\"/>" );
+ }
+
void writeAttributes(
Writer writer, ComponentDirective directive, String pad ) throws
IOException
{
@@ -428,6 +449,11 @@
ComponentDirective component = (ComponentDirective) directive;
writeTaggedComponent( writer, component, key, pad );
}
+ else if( directive instanceof ImportDirective )
+ {
+ ImportDirective importDirective = (ImportDirective) directive;
+ writeTaggedImport( writer, importDirective, key, pad );
+ }
else
{
String classname = directive.getClass().getName();




  • r1534 - trunk/main/metro/runtime/src/main/net/dpml/metro/builder, mcconnell at BerliOS, 07/03/2006

Archive powered by MHonArc 2.6.24.

Top of Page