Skip to Content.
Sympa Menu

notify-dpml - r1161 - in trunk/lab: . component component/etc/deliverables/xsds lang/src/main/dpmlx/schema part part/etc/deliverables/xsds test test/etc/test test/src/test/dpmlx/schema/test

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: r1161 - in trunk/lab: . component component/etc/deliverables/xsds lang/src/main/dpmlx/schema part part/etc/deliverables/xsds test test/etc/test test/src/test/dpmlx/schema/test
  • Date: Thu, 2 Mar 2006 15:05:01 +0100

Author: mcconnell
Date: 2006-03-02 15:04:51 +0100 (Thu, 02 Mar 2006)
New Revision: 1161

Added:
trunk/lab/component/etc/deliverables/xsds/component.xsd
trunk/lab/lang/src/main/dpmlx/schema/DOMDocumentBuilder.java
trunk/lab/part/etc/deliverables/xsds/part.xsd
Removed:
trunk/lab/component/etc/deliverables/xsds/project.xsd
trunk/lab/lang/src/main/dpmlx/schema/StandardBuilder.java
trunk/lab/library/
trunk/lab/part/etc/deliverables/xsds/project.xsd
trunk/lab/test/etc/test/library.xml
trunk/lab/test/src/test/dpmlx/schema/test/LibraryTestCase.java
Modified:
trunk/lab/component/build.xml
trunk/lab/lang/src/main/dpmlx/schema/PartBuilder.java
trunk/lab/lang/src/main/dpmlx/schema/PluginStrategyBuilder.java
trunk/lab/library.xml
trunk/lab/part/build.xml
trunk/lab/test/build.xml
trunk/lab/test/etc/test/component.xml
trunk/lab/test/etc/test/plugin.xml
trunk/lab/test/src/test/dpmlx/schema/test/SchemaTestCase.java
Log:
continued progress of validating an XML schema approach

Modified: trunk/lab/component/build.xml
===================================================================
--- trunk/lab/component/build.xml 2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/component/build.xml 2006-03-02 14:04:51 UTC (rev 1161)
@@ -12,7 +12,7 @@
</target>

<target name="package" depends="standard.package">
- <move file="target/deliverables/xsds/project.xsd"
+ <move file="target/deliverables/xsds/component.xsd"

toFile="target/deliverables/xsds/${project.name}-${project.version}.xsd"/>
</target>


Copied: trunk/lab/component/etc/deliverables/xsds/component.xsd (from rev
1159, trunk/lab/component/etc/deliverables/xsds/project.xsd)
===================================================================
--- trunk/lab/component/etc/deliverables/xsds/project.xsd 2006-03-01
15:02:51 UTC (rev 1159)
+++ trunk/lab/component/etc/deliverables/xsds/component.xsd 2006-03-02
14:04:51 UTC (rev 1161)
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema";
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+ xmlns:part="@PART-XSD-URI@"
+ xmlns:metro="@PROJECT-XSD-URI@"
+ targetNamespace="@PROJECT-XSD-URI@"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.w3.org/XML/1998/namespace";
+ schemaLocation="artifact:xsd:org/w3/xml#2001"/>
+
+ <import namespace="@PART-XSD-URI@"
+ schemaLocation="@PART-XSD-URI@"/>
+
+ <element name="component" type="metro:part"/>
+
+ <!--
+ Definition of a plugin component deployment strategy.
+ -->
+ <complexType name="definition">
+ <complexContent>
+ <extension base="part:StrategyType">
+ <sequence>
+ <element name="controller" type="metro:ControllerType"
minOccurs="0" maxOccurs="1"/>
+ <element name="component" type="metro:ComponentType"
minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="ControllerType">
+ <sequence>
+ <element name="param" type="metro:ValueType" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="uri" type="string"/>
+ </complexType>
+
+ <complexType name="ComponentType">
+ <sequence>
+ <element name="context" type="metro:ContextType" minOccurs="0"
maxOccurs="1"/>
+ <element name="parts" type="metro:PartsType" minOccurs="0"
maxOccurs="1"/>
+ </sequence>
+ <attribute name="class" type="string"/>
+ <attribute name="lifestyle" type="metro:lifestyle"/>
+ <attribute name="collection" type="metro:collection"/>
+ </complexType>
+
+ <complexType name="part">
+ <complexContent>
+ <extension base="metro:ComponentType">
+ <attribute name="alias" type="boolean"/>
+ <attribute name="type" type="string" default="part"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="ContextType">
+ <sequence>
+ <element name="entry" type="metro:EntryType" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="EntryType">
+ <sequence>
+ <element name="value" type="metro:ValueType" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="key" type="string"/>
+ <attribute name="value" type="string"/>
+ </complexType>
+
+ <complexType name="ValueType">
+ <sequence>
+ <element name="value" type="metro:ValueType" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string"/>
+ <attribute name="value" type="string"/>
+ </complexType>
+
+ <complexType name="PartsType">
+ <sequence>
+ <element name="component" type="metro:TaggedComponentType"
minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="TaggedComponentType">
+ <complexContent>
+ <extension base="metro:ComponentType">
+ <attribute name="key" type="string" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="lifestyle">
+ <restriction base="string">
+ <enumeration value="singleton"/>
+ <enumeration value="thread"/>
+ <enumeration value="transient"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="collection">
+ <restriction base="string">
+ <enumeration value="hard"/>
+ <enumeration value="soft"/>
+ <enumeration value="weak"/>
+ </restriction>
+ </simpleType>
+
+</schema>

Deleted: trunk/lab/component/etc/deliverables/xsds/project.xsd
===================================================================
--- trunk/lab/component/etc/deliverables/xsds/project.xsd 2006-03-01
15:03:36 UTC (rev 1160)
+++ trunk/lab/component/etc/deliverables/xsds/project.xsd 2006-03-02
14:04:51 UTC (rev 1161)
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
- xmlns:part="@PART-XSD-URI@"
- targetNamespace="@PROJECT-XSD-URI@"
- xmlns="@PROJECT-XSD-URI@"
- elementFormDefault="qualified">
-
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace";
- schemaLocation="artifact:xsd:org/w3/xml#2001"/>
-
- <xsd:import namespace="@PART-XSD-URI@"
- schemaLocation="@PART-XSD-URI@"/>
-
- <xsd:element name="component" type="ComponentType"/>
-
- <!--
- Definition of a plugin component deployment strategy.
- -->
- <xsd:complexType name="ComponentStrategyType">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">
- Definition of a component deployment model for the DPML Metro
Platform.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexContent>
- <xsd:extension base="part:StrategyType">
- <xsd:sequence>
- <xsd:element name="controller" type="ControllerType"
minOccurs="0" maxOccurs="1"/>
- <xsd:element name="component" type="ComponentType" minOccurs="0"
maxOccurs="1"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="ControllerType">
- <xsd:sequence>
- <xsd:element name="param" type="ValueType" minOccurs="0"
maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="uri" type="xsd:string"/>
- </xsd:complexType>
-
- <xsd:complexType name="ComponentType">
- <xsd:sequence>
- <xsd:element name="context" type="ContextType" minOccurs="0"
maxOccurs="1"/>
- <xsd:element name="parts" type="PartsType" minOccurs="0"
maxOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="type" type="xsd:string"/>
- <xsd:attribute name="lifestyle" type="xsd:string"/>
- <xsd:attribute name="collection" type="xsd:string"/>
- </xsd:complexType>
-
- <xsd:complexType name="ContextType">
- <xsd:sequence>
- <xsd:element name="entry" type="EntryType" minOccurs="0"
maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="EntryType">
- <xsd:sequence>
- <xsd:element name="value" type="ValueType" minOccurs="0"
maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="key" type="xsd:string"/>
- <xsd:attribute name="value" type="xsd:string"/>
- </xsd:complexType>
-
- <xsd:complexType name="ValueType">
- <xsd:sequence>
- <xsd:element name="value" type="ValueType" minOccurs="0"
maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="class" type="xsd:string"/>
- <xsd:attribute name="value" type="xsd:string"/>
- </xsd:complexType>
-
- <xsd:complexType name="PartsType">
- <xsd:sequence>
- <xsd:element name="component" type="TaggedComponentType"
minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="TaggedComponentType">
- <xsd:complexContent>
- <xsd:extension base="ComponentType">
- <xsd:attribute name="key" type="xsd:string"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
-</xsd:schema>

Copied: trunk/lab/lang/src/main/dpmlx/schema/DOMDocumentBuilder.java (from
rev 1157, trunk/lab/lang/src/main/dpmlx/schema/StandardBuilder.java)
===================================================================
--- trunk/lab/lang/src/main/dpmlx/schema/StandardBuilder.java 2006-03-01
05:15:17 UTC (rev 1157)
+++ trunk/lab/lang/src/main/dpmlx/schema/DOMDocumentBuilder.java
2006-03-02 14:04:51 UTC (rev 1161)
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dpmlx.schema;
+
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.validation.Validator;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import net.dpml.transit.Artifact;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+//import org.xml.sax.helpers.DefaultHandler;
+
+import org.w3c.dom.Document;
+
+public class DOMDocumentBuilder
+{
+ private static final String FEATURE_SECURE_PROCESSING =
+ "http://javax.xml.XMLConstants/feature/secure-processing";;
+
+ private static final String W3C_XML_SCHEMA_NS_URI =
+ "http://www.w3.org/2001/XMLSchema";;
+
+ //
+ // implementation
+ //
+
+ public Document parse( String source ) throws Exception
+ {
+ DocumentBuilder db = getDocumentBuilder();
+ return db.parse( source );
+ }
+
+ public Document parse( URI uri ) throws Exception
+ {
+ DocumentBuilder db = getDocumentBuilder();
+ return db.parse( uri.toASCIIString() );
+ }
+
+ private DocumentBuilder getDocumentBuilder() throws Exception
+ {
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware( true );
+ setupBuilderForSchemaValidation( factory );
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setErrorHandler( new ParserAPIUsage() );
+ return builder;
+ }
+
+ private void setupBuilderForSchemaValidation( DocumentBuilderFactory dbf
)
+ {
+ try
+ {
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(
W3C_XML_SCHEMA_NS_URI );
+ Schema schema = schemaFactory.newSchema();
+ dbf.setSchema( schema );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error while configuring XML parser for schema
validation.";
+ throw new RuntimeException( error, e );
+ }
+ }
+
+ private URL getURL( URI uri ) throws Exception
+ {
+ if( Artifact.isRecognized( uri ) )
+ {
+ return Artifact.createArtifact( uri ).toURL();
+ }
+ else
+ {
+ return uri.toURL();
+ }
+ }
+}

Modified: trunk/lab/lang/src/main/dpmlx/schema/PartBuilder.java
===================================================================
--- trunk/lab/lang/src/main/dpmlx/schema/PartBuilder.java 2006-03-01
15:03:36 UTC (rev 1160)
+++ trunk/lab/lang/src/main/dpmlx/schema/PartBuilder.java 2006-03-02
14:04:51 UTC (rev 1161)
@@ -51,7 +51,7 @@
private static final String SCHEMA_INSTANCE_NS =
"http://www.w3.org/2001/XMLSchema-instance";;

- private static StandardBuilder BUILDER = new StandardBuilder();
+ private static DOMDocumentBuilder BUILDER = new DOMDocumentBuilder();

public Part loadPart( URI uri ) throws Exception
{
@@ -92,6 +92,11 @@
private Strategy getStrategy( ClassLoader loader, Element root ) throws
Exception
{
Element strategy = ElementHelper.getChild( root, "strategy" );
+ if( null == strategy )
+ {
+ final String error = "Missing strategy element in: " + root;
+ throw new IllegalArgumentException( error );
+ }
TypeInfo info = strategy.getSchemaTypeInfo();
String namespace = info.getTypeNamespace();
Artifact artifact = Artifact.createArtifact( namespace );

Modified: trunk/lab/lang/src/main/dpmlx/schema/PluginStrategyBuilder.java
===================================================================
--- trunk/lab/lang/src/main/dpmlx/schema/PluginStrategyBuilder.java
2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/lang/src/main/dpmlx/schema/PluginStrategyBuilder.java
2006-03-02 14:04:51 UTC (rev 1161)
@@ -26,6 +26,7 @@

import net.dpml.transit.util.ElementHelper;

+import org.w3c.dom.TypeInfo;
import org.w3c.dom.Element;

/**
@@ -44,29 +45,31 @@
"Invalid element name.";
throw new IllegalArgumentException( error );
}
- Element classElement = ElementHelper.getChild( element, "class" );
- if( null != classElement )
+
+ TypeInfo info = element.getSchemaTypeInfo();
+ String type = info.getTypeName();
+ if( "plugin".equals( type ) )
{
- String classname = ElementHelper.getValue( classElement );
+ String classname = ElementHelper.getAttribute( element, "class"
);
return new ClassStrategy( classname );
}
- else
+ else if( "resource".equals( type ) )
{
- Element resourceElement = ElementHelper.getChild( element,
"resource" );
- if( null == resourceElement )
- {
- final String error =
- "Invalid strategy element.";
- throw new IllegalArgumentException( error );
- }
-
- Element urnElement = ElementHelper.getChild( resourceElement,
"urn" );
- Element pathElement = ElementHelper.getChild( resourceElement,
"path" );
+ Element urnElement = ElementHelper.getChild( element, "urn" );
+ Element pathElement = ElementHelper.getChild( element, "path" );
String urn = ElementHelper.getValue( urnElement );
String path = ElementHelper.getValue( pathElement );
Resource resource = new Resource( urn, path );
return new ResourceStrategy( resource );
}
+ else
+ {
+ final String error =
+ "Strategy element ["
+ + type
+ + "] is not recognized.";
+ throw new IllegalArgumentException( error );
+ }
}

/**

Deleted: trunk/lab/lang/src/main/dpmlx/schema/StandardBuilder.java
===================================================================
--- trunk/lab/lang/src/main/dpmlx/schema/StandardBuilder.java 2006-03-01
15:03:36 UTC (rev 1160)
+++ trunk/lab/lang/src/main/dpmlx/schema/StandardBuilder.java 2006-03-02
14:04:51 UTC (rev 1161)
@@ -1,148 +0,0 @@
-/*
- * Copyright 2005 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package dpmlx.schema;
-
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.stream.StreamSource;
-
-import net.dpml.transit.Artifact;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-import org.xml.sax.helpers.DefaultHandler;
-
-import org.w3c.dom.Document;
-
-public class StandardBuilder extends DefaultHandler
-{
- private static final String XML_CONSTANTS_CLASSNAME =
- "javax.xml.XMLConstants";
-
- private static final String SCHEMA_FACTORY_CLASSNAME =
- "javax.xml.validation.SchemaFactory";
-
- private static final String SCHEMA_CLASSNAME =
- "javax.xml.validation.Schema";
-
- private static final String FEATURE_SECURE_PROCESSING =
- "http://javax.xml.XMLConstants/feature/secure-processing";;
-
- private static final String W3C_XML_SCHEMA_NS_URI =
- "http://www.w3.org/2001/XMLSchema";;
-
- private static boolean VALIDATING = isSchemaCapable();
-
- //
- // implementation
- //
-
- public Document parse( String source ) throws Exception
- {
- DocumentBuilder db = getDocumentBuilder();
- return db.parse( source );
- }
-
- public Document parse( URI uri ) throws Exception
- {
- DocumentBuilder db = getDocumentBuilder();
- return db.parse( uri.toASCIIString() );
- }
-
- private DocumentBuilder getDocumentBuilder() throws Exception
- {
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware( true );
- if( VALIDATING )
- {
- setupBuilderForSchemaValidation( factory );
- }
- DocumentBuilder builder = factory.newDocumentBuilder();
- builder.setErrorHandler( new ParserAPIUsage() );
- return builder;
- }
-
- private void setupBuilderForSchemaValidation( DocumentBuilderFactory dbf
)
- {
- try
- {
- ClassLoader classloader = getClass().getClassLoader();
- Class schemaFactoryClass = classloader.loadClass(
SCHEMA_FACTORY_CLASSNAME );
- Class schemaClass = classloader.loadClass( SCHEMA_CLASSNAME );
-
- Method newInstanceMethod =
- schemaFactoryClass.getMethod( "newInstance", new Class[]{
String.class } );
- Object schemaFactory =
- newInstanceMethod.invoke( null, new Object[]{
W3C_XML_SCHEMA_NS_URI } );
- Method newSchemaMethod =
- schemaFactoryClass.getMethod( "newSchema", new Class[0] );
- Object schemaObject =
- newSchemaMethod.invoke( schemaFactory, new Object[0] );
- Method setSchemaMethod =
- DocumentBuilderFactory.class.getMethod( "setSchema", new
Class[]{ schemaClass } );
- setSchemaMethod.invoke( dbf, new Object[]{ schemaObject } );
- }
- catch( Exception e )
- {
- final String error =
- "Unexpected error while configuring XML parser for schema
validation.";
- throw new RuntimeException( error, e );
- }
- }
-
- private URL getURL( URI uri ) throws Exception
- {
- if( Artifact.isRecognized( uri ) )
- {
- return Artifact.createArtifact( uri ).toURL();
- }
- else
- {
- return uri.toURL();
- }
- }
-
-
- private static boolean isSchemaCapable()
- {
- try
- {
- ClassLoader classloader = StandardBuilder.class.getClassLoader();
- classloader.loadClass( XML_CONSTANTS_CLASSNAME );
- System.out.println( "validating" );
- return true;
- }
- catch( ClassNotFoundException e )
- {
- System.out.println( "validation disabled" );
- return false;
- }
- }
-}

Modified: trunk/lab/library.xml
===================================================================
--- trunk/lab/library.xml 2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/library.xml 2006-03-02 14:04:51 UTC (rev 1161)
@@ -16,18 +16,12 @@

<module name="dpmlx">

- <project name="dpmlx-library" basedir="library">
- <types>
- <type id="xsd"/>
- </types>
- </project>
-
<project name="dpmlx-part" basedir="part">
<types>
<type id="xsd"/>
</types>
</project>
-
+
<project name="dpmlx-lang" basedir="lang">
<types>
<type id="jar"/>

Modified: trunk/lab/part/build.xml
===================================================================
--- trunk/lab/part/build.xml 2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/part/build.xml 2006-03-02 14:04:51 UTC (rev 1161)
@@ -11,7 +11,7 @@
</target>

<target name="package" depends="standard.package">
- <move file="target/deliverables/xsds/project.xsd"
+ <move file="target/deliverables/xsds/part.xsd"

toFile="target/deliverables/xsds/${project.name}-${project.version}.xsd"/>
</target>


Copied: trunk/lab/part/etc/deliverables/xsds/part.xsd (from rev 1159,
trunk/lab/part/etc/deliverables/xsds/project.xsd)
===================================================================
--- trunk/lab/part/etc/deliverables/xsds/project.xsd 2006-03-01 15:02:51
UTC (rev 1159)
+++ trunk/lab/part/etc/deliverables/xsds/part.xsd 2006-03-02 14:04:51
UTC (rev 1161)
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema";
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+ xmlns:part="@PROJECT-XSD-URI@"
+ targetNamespace="@PROJECT-XSD-URI@"
+ elementFormDefault="qualified">
+
+ <element name="part" type="part:PartType"/>
+
+ <complexType name="PartType">
+ <sequence>
+ <element name="info" type="part:InfoType" minOccurs="0"
maxOccurs="1"/>
+ <element name="strategy" type="part:StrategyType" minOccurs="1"
maxOccurs="1"/>
+ <element name="classpath" type="part:ClassPathType" minOccurs="0"
maxOccurs="1"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="StrategyType" abstract="true"/>
+
+ <element name="plugin" type="part:plugin"/>
+ <complexType name="plugin">
+ <complexContent>
+ <extension base="part:StrategyType">
+ <attribute name="class" type="string"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="resource" type="part:resource"/>
+ <complexType name="resource">
+ <complexContent>
+ <extension base="part:StrategyType">
+ <sequence>
+ <element name="urn" type="part:URNType"/>
+ <element name="path" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="ClassPathType">
+ <sequence>
+ <element name="system" type="part:ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
+ <element name="public" type="part:ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
+ <element name="protected" type="part:ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
+ <element name="private" type="part:ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="ClassLoaderType">
+ <sequence>
+ <element name="uri" type="part:URIType" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="InfoType">
+ <sequence>
+ <element name="description" type="string" minOccurs="0"
maxOccurs="1"/>
+ </sequence>
+ <attribute name="title" type="string"/>
+ </complexType>
+
+ <complexType name="URIType">
+ <simpleContent>
+ <extension base="anyURI"/>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="URNType">
+ <simpleContent>
+ <extension base="anyURI"/>
+ </simpleContent>
+ </complexType>
+
+
+</schema>
+

Deleted: trunk/lab/part/etc/deliverables/xsds/project.xsd
===================================================================
--- trunk/lab/part/etc/deliverables/xsds/project.xsd 2006-03-01 15:03:36
UTC (rev 1160)
+++ trunk/lab/part/etc/deliverables/xsds/project.xsd 2006-03-02 14:04:51
UTC (rev 1161)
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
- targetNamespace="@PROJECT-XSD-URI@"
- xmlns="@PROJECT-XSD-URI@"
- elementFormDefault="qualified">
-
- <xsd:element name="part" type="PartType"/>
-
- <xsd:complexType name="PartType">
- <xsd:sequence>
- <xsd:element name="info" type="InfoType"/>
- <xsd:element name="strategy" type="StrategyType"/>
- <xsd:element name="classpath" type="ClassPathType"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="StrategyType" abstract="true">
- <xsd:attribute name="uri" type="xsd:anyURI"/>
- </xsd:complexType>
-
- <xsd:complexType name="ClassPathType">
- <xsd:sequence>
- <xsd:element name="system" type="ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
- <xsd:element name="public" type="ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
- <xsd:element name="protected" type="ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
- <xsd:element name="private" type="ClassLoaderType" minOccurs="0"
maxOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="ClassLoaderType">
- <xsd:sequence>
- <xsd:element name="uri" type="URIType" minOccurs="0"
maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="InfoType">
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="title" type="xsd:string"/>
- </xsd:complexType>
-
- <xsd:complexType name="URIType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:anyURI"/>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:complexType name="PluginType">
- <xsd:complexContent>
- <xsd:extension base="StrategyType">
- <xsd:choice>
- <xsd:element name="class" type="ClassType"/>
- <xsd:element name="resource" type="ResourceType"/>
- </xsd:choice>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="ClassType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:string"/>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:complexType name="ResourceType">
- <xsd:sequence>
- <xsd:element name="urn" type="URNType"/>
- <xsd:element name="path" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="URNType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:anyURI"/>
- </xsd:simpleContent>
- </xsd:complexType>
-
-
-</xsd:schema>
-

Modified: trunk/lab/test/build.xml
===================================================================
--- trunk/lab/test/build.xml 2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/test/build.xml 2006-03-02 14:04:51 UTC (rev 1161)
@@ -9,7 +9,6 @@
<target name="init" depends="standard.init">
<x:filter feature="uri" type="xsd" token="COMPONENT-XSD-URI"
ref="dpmlx/dpmlx-component"/>
<x:filter feature="uri" type="xsd" token="PART-XSD-URI"
ref="dpmlx/dpmlx-part"/>
- <x:filter feature="uri" type="xsd" token="LIBRARY-XSD-URI"
ref="dpmlx/dpmlx-library"/>
</target>

</project>

Modified: trunk/lab/test/etc/test/component.xml
===================================================================
--- trunk/lab/test/etc/test/component.xml 2006-03-01 15:03:36 UTC (rev
1160)
+++ trunk/lab/test/etc/test/component.xml 2006-03-02 14:04:51 UTC (rev
1161)
@@ -1,7 +1,8 @@
<?xml version="1.0"?>
<part xmlns="@PART-XSD-URI@"
+ xmlns:part="@PART-XSD-URI@"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
- xmlns:m="@COMPONENT-XSD-URI@"
+ xmlns:component="@COMPONENT-XSD-URI@"
xsi:schemaLocation="
@PART-XSD-URI@ @PART-XSD-URI@
@COMPONENT-XSD-URI@ @COMPONENT-XSD-URI@
@@ -13,16 +14,22 @@
</description>
</info>

- <strategy xsi:type="m:ComponentStrategyType">
- <m:controller uri="link:plugin:dpml/metro/dpml-metro-runtime"/>
- <m:component type="org.acme.Widget">
- <m:context>
- <m:entry key="foo" value="abc"/>
- <m:entry key="bar">
- <m:value class="int" value="2"/>
- </m:entry>
- </m:context>
- </m:component>
+ <strategy xsi:type="component:definition">
+ <component xmlns="@COMPONENT-XSD-URI@" class="org.acme.Widget">
+ <context>
+ <entry key="foo" value="abc"/>
+ <entry key="bar">
+ <value class="Gizmo">
+ <value value="foo"/>
+ <value value="bar"/>
+ </value>
+ </entry>
+ </context>
+ <parts>
+ <component key="gizmo" class="BigGizmo" lifestyle="thread"
collection="soft"/>
+ <component key="flintstone" class="AnotherWidget"
lifestyle="singleton" collection="hard"/>
+ </parts>
+ </component>
</strategy>

<classpath>

Deleted: trunk/lab/test/etc/test/library.xml
===================================================================
--- trunk/lab/test/etc/test/library.xml 2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/test/etc/test/library.xml 2006-03-02 14:04:51 UTC (rev 1161)
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<library xmlns="@LIBRARY-XSD-URI@"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
- xsi:schemaLocation="
- @LIBRARY-XSD-URI@ @LIBRARY-XSD-URI@
- " >
-
-
-</library>

Modified: trunk/lab/test/etc/test/plugin.xml
===================================================================
--- trunk/lab/test/etc/test/plugin.xml 2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/test/etc/test/plugin.xml 2006-03-02 14:04:51 UTC (rev 1161)
@@ -11,15 +11,7 @@
</description>
</info>

- <strategy xsi:type="PluginType">
- <class>Widget</class>
- <!--
- <resource>
- <urn>dpml:metro</urn>
- <path>net/dpml/metro/tools/antlib.xml</path>
- </resource>
- -->
- </strategy>
+ <strategy xsi:type="plugin" class="Widget"/>

<classpath>
<public>

Deleted: trunk/lab/test/src/test/dpmlx/schema/test/LibraryTestCase.java
===================================================================
--- trunk/lab/test/src/test/dpmlx/schema/test/LibraryTestCase.java
2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/test/src/test/dpmlx/schema/test/LibraryTestCase.java
2006-03-02 14:04:51 UTC (rev 1161)
@@ -1,46 +0,0 @@
-
-package dpmlx.schema.test;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import dpmlx.schema.StandardBuilder;
-
-import junit.framework.TestCase;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Test the demo class..
- */
-public class LibraryTestCase extends TestCase
-{
- static
- {
- System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
- }
-
- StandardBuilder m_builder;
-
- /**
- * Test the demo class.
- */
- public void setUp() throws Exception
- {
- m_builder = new StandardBuilder();
- }
-
- /**
- * Test the demo class.
- */
- public void testLibrary() throws Exception
- {
- String base = System.getProperty( "project.test.dir" );
- File test = new File( base );
- File file = new File( test, "library.xml" );
- m_builder.parse( file.toURI().toASCIIString() );
- }
-
-}

Modified: trunk/lab/test/src/test/dpmlx/schema/test/SchemaTestCase.java
===================================================================
--- trunk/lab/test/src/test/dpmlx/schema/test/SchemaTestCase.java
2006-03-01 15:03:36 UTC (rev 1160)
+++ trunk/lab/test/src/test/dpmlx/schema/test/SchemaTestCase.java
2006-03-02 14:04:51 UTC (rev 1161)
@@ -56,10 +56,8 @@
File file = new File( test, path );
System.out.println( "source: " + file );
Part part = m_builder.loadPart( file.toURI() );
- System.out.println( "# PART: " + part );
Strategy strategy = part.getStrategy();
- System.out.println( "# STRATEGY: " + strategy );
- System.out.println( "# Controller: " + strategy.getControllerURI() );
- System.out.println( "# Data: " +
strategy.getDeploymentData().getClass().getName() );
+ System.out.println( " Controller: " + strategy.getControllerURI() );
+ System.out.println( " Data: " +
strategy.getDeploymentData().getClass().getName() );
}
}




  • r1161 - in trunk/lab: . component component/etc/deliverables/xsds lang/src/main/dpmlx/schema part part/etc/deliverables/xsds test test/etc/test test/src/test/dpmlx/schema/test, mcconnell at BerliOS, 03/02/2006

Archive powered by MHonArc 2.6.24.

Top of Page