summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2009-04-01 10:34:16 +0000
committerramkumar <ramkumar@13f79535-47bb-0310-9956-ffa450edef68>2009-04-01 10:34:16 +0000
commited3a1071ac2b2deffbd5dd553af902115f305a96 (patch)
treeb759d0cf44ad392e07e40125061b07a2c7956516
parentc656ee16e26e879aaf6fde55da211ffea026000b (diff)
Fixes for TUSCANY-2945, 2947, 2948
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@760849 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--branches/sca-java-1.x/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java36
1 files changed, 9 insertions, 27 deletions
diff --git a/branches/sca-java-1.x/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java b/branches/sca-java-1.x/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
index c12116f786..ffa3b8879a 100644
--- a/branches/sca-java-1.x/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
+++ b/branches/sca-java-1.x/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
@@ -85,24 +85,7 @@ public class XSDModelResolver implements ModelResolver {
public <T> T resolveModel(Class<T> modelClass, T unresolved) {
XSDefinition definition = (XSDefinition)unresolved;
- String namespace = definition.getNamespace();
- XSDefinition resolved = null;
-
- // Lookup for a definition using the non-sca mechanism
- if (definition.getDocument() != null) {
- try {
- List<XSDefinition> list = new ArrayList<XSDefinition>();
- list.add(definition);
- map.put(namespace, list);
- resolved = aggregate(list);
- // no exception thrown, then its resolved.
- if (resolved != null && !resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- } catch (ContributionRuntimeException e) {
- // do nothing, lookup using sca mechanism
- }
- }
+ String namespace = definition.getNamespace();
// Lookup a definition for the given namespace within the
// current contribution.
@@ -115,7 +98,14 @@ public class XSDModelResolver implements ModelResolver {
modelXSD = list.get(index);
modelXSD.setDocument(definition.getDocument());
}
- }
+ }
+ if (list == null && definition.getDocument() != null) {
+ // Hit for the 1st time
+ list = new ArrayList<XSDefinition>();
+ list.add(definition);
+ map.put(namespace, list);
+ }
+ XSDefinition resolved = null;
try {
resolved = aggregate(list);
} catch (ContributionRuntimeException e) {
@@ -167,14 +157,6 @@ public class XSDModelResolver implements ModelResolver {
String uri = null;
if (definition.getLocation() != null) {
uri = definition.getLocation().toString();
- }
- for (XmlSchema d : schemaCollection.getXmlSchemas()) {
- if (d.getSourceURI() != null && d.getSourceURI().equals(uri)) {
- definition.setSchemaCollection(schemaCollection);
- definition.setSchema(d);
- definition.setUnresolved(false);
- return;
- }
}
XmlSchema schema = null;
try {