You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2005/09/30 15:23:20 UTC
svn commit: r292723 - in
/incubator/woden/java/src/org/apache/woden/internal: DOMWSDLReader.java
util/ComponentModelBuilder.java wsdl20/DescriptionImpl.java
Author: jkaputin
Date: Fri Sep 30 06:23:14 2005
New Revision: 292723
URL: http://svn.apache.org/viewcvs?rev=292723&view=rev
Log:
Building the wsdl component model from the xml model,
code to add ElementDeclarations and TypeDefinitions to
the DescriptionComponent.
Modified:
incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
Modified: incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java?rev=292723&r1=292722&r2=292723&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Fri Sep 30 06:23:14 2005
@@ -460,9 +460,9 @@
{
TypesElement types = desc.createTypesElement();
- //TODO for now, set to XML Schema namespace. Later,
+ //TODO for now set to W3 XML Schema. Later,
//add support for non-XML Schema type systems
- types.setTypeSystem(SchemaConstants.NS_URI_XSD_2001);
+ types.setTypeSystem(Constants.TYPE_XSD_2001);
Element tempEl = DOMUtils.getFirstChildElement(typesEl);
Modified: incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java?rev=292723&r1=292722&r2=292723&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java Fri Sep 30 06:23:14 2005
@@ -20,7 +20,12 @@
import java.util.List;
import java.util.Vector;
+import javax.xml.namespace.QName;
+
+import org.apache.woden.internal.wsdl20.Constants;
import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.internal.wsdl20.TypeDefinitionImpl;
import org.apache.woden.schema.Schema;
import org.apache.woden.schema.SchemaImport;
import org.apache.woden.wsdl20.Description;
@@ -29,6 +34,7 @@
import org.apache.xerces.xs.XSConstants;
import org.apache.xerces.xs.XSModel;
import org.apache.xerces.xs.XSNamedMap;
+import org.apache.xerces.xs.XSObject;
/**
* Converts the xml representation of a WSDL document to the WSDL
@@ -41,7 +47,7 @@
public class ComponentModelBuilder {
private DescriptionElement fDescElement;
- private Description fDescComponent;
+ private DescriptionImpl fDescComponent;
//TODO support for other (non-Schema) type systems
@@ -49,6 +55,7 @@
private List fInScopeSchemas = new Vector();
//Collection of schema target namespace Strings
+ //TODO not sure if this is needed
private List fInScopeSchemaNamespaces = new Vector();
/*
@@ -64,8 +71,7 @@
collectImportedWsdl();
collectInScopeSchemas();
- buildElementDeclarations();
- buildTypeDefinitions();
+ buildElementsAndTypes();
return fDescComponent;
}
@@ -89,6 +95,8 @@
//TODO ensure only schemas and schema namespaces in scope per
//W3C WSDL 2.0 spec are collected.
+ //TODO not sure if the in scope namespaces collection is needed
+
TypesElement types = fDescElement.getTypesElement();
Schema s = null;
@@ -135,26 +143,41 @@
/*
* Extract from the collections of in-scope schemas and schema namespaces
- * the element declarations.
+ * the element declarations and type definitions.
*/
- private void buildElementDeclarations()
+ private void buildElementsAndTypes()
{
- Schema schema = null;
- XSModel xsModel = null;
- List elementDeclarations = new Vector();
-
Iterator i = fInScopeSchemas.iterator();
while(i.hasNext())
{
- schema = (Schema)i.next();
- xsModel = schema.getSchemaContent();
-
- XSNamedMap xsNamedMap =
- xsModel.getComponents(XSConstants.ELEMENT_DECLARATION);
-
- //TODO w.i.p.
+ Schema schema = (Schema)i.next();
+ buildElementDeclarations(schema);
+ buildTypeDefinitions(schema);
}
+ }
+
+ /*
+ * Extract the element declarations from the given schema.
+ */
+ private void buildElementDeclarations(Schema schema)
+ {
+ XSModel xsModel = schema.getSchemaContent();
+ XSNamedMap map =
+ xsModel.getComponentsByNamespace(XSConstants.ELEMENT_DECLARATION,
+ schema.getTargetNamespace());
+ for(int j=0; j < map.getLength(); j++)
+ {
+ XSObject xsED = map.item(j);
+ QName qn = new QName(xsED.getNamespace(), xsED.getName());
+
+ ElementDeclarationImpl ed = new ElementDeclarationImpl();
+ ed.setName(qn);
+ ed.setContentModel(Constants.API_W3C_XS);
+ ed.setContent(xsED);
+
+ fDescComponent.addElementDeclaration(ed);
+ }
}
/*
@@ -162,9 +185,25 @@
* the type definitions.
*/
- private void buildTypeDefinitions()
+ private void buildTypeDefinitions(Schema schema)
{
+ XSModel xsModel = schema.getSchemaContent();
+ XSNamedMap map =
+ xsModel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION,
+ schema.getTargetNamespace());
+ for(int j=0; j < map.getLength(); j++)
+ {
+ XSObject xsTD = map.item(j);
+ QName qn = new QName(xsTD.getNamespace(), xsTD.getName());
+
+ TypeDefinitionImpl td = new TypeDefinitionImpl();
+ td.setName(qn);
+ td.setContentModel(Constants.API_W3C_XS);
+ td.setContent(xsTD);
+
+ fDescComponent.addTypeDefinition(td);
+ }
}
}
Modified: incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java?rev=292723&r1=292722&r2=292723&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java Fri Sep 30 06:23:14 2005
@@ -80,6 +80,11 @@
// TODO Auto-generated method stub
return null;
}
+
+ public void addElementDeclaration(ElementDeclaration elDec)
+ {
+ fElementDeclarations.add(elDec);
+ }
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.Description#getTypeDefinitions()
@@ -87,6 +92,11 @@
public TypeDefinition[] getTypeDefinitions() {
// TODO Auto-generated method stub
return null;
+ }
+
+ public void addTypeDefinition(TypeDefinition typeDef)
+ {
+ fTypeDefinitions.add(typeDef);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org