Author: mriou
Date: Fri Sep 29 14:13:16 2006
New Revision: 451441

URL: http://svn.apache.org/viewvc?view=rev&rev=451441
Log:
These should resolve relatively as well.

Modified:
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentEntityResolver.java
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentEntityResolver.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentEntityResolver.java?view=diff&rev=451441&r1=451440&r2=451441
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentEntityResolver.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentEntityResolver.java
 Fri Sep 29 14:13:16 2006
@@ -26,24 +26,41 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 
 /**
  * Resolves references inide the deployment unit.
  */
 public class DocumentEntityResolver implements XMLEntityResolver {
 
-  private File _docRoot;
+    private File _docRoot;
 
-  public DocumentEntityResolver(File docRoot) {
-    _docRoot = docRoot;
-  }
-
-  public XMLInputSource resolveEntity(XMLResourceIdentifier 
resourceIdentifier) throws XNIException, IOException {
-    XMLInputSource src = new XMLInputSource(resourceIdentifier);
-    String resourceName = resourceIdentifier.getLiteralSystemId();
-    if (resourceName.indexOf("/") >= 0)
-      resourceName = resourceName.substring(resourceName.indexOf("/") + 1, 
resourceName.length());
-    src.setByteStream(new File(_docRoot, resourceName).toURL().openStream());
-    return src;
-  }
+    public DocumentEntityResolver(File docRoot) {
+        _docRoot = docRoot;
+    }
+
+    public XMLInputSource resolveEntity(XMLResourceIdentifier 
resourceIdentifier) throws XNIException, IOException {
+        XMLInputSource src = new XMLInputSource(resourceIdentifier);
+        String resourceName = resourceIdentifier.getLiteralSystemId();
+        String base;
+        try {
+            base = new 
URI(resourceIdentifier.getBaseSystemId()).toURL().getFile();
+        } catch (URISyntaxException e) {
+            throw new RuntimeException("Base system id incorrect, parser 
error", e);
+        }
+
+        System.out.println("1 " + resourceName);
+        System.out.println("11 " + base);
+        System.out.println("2 " + resourceIdentifier.getBaseSystemId());
+        System.out.println("3 " + resourceIdentifier.getExpandedSystemId());
+        System.out.println("4 " + resourceIdentifier.getLiteralSystemId());
+        System.out.println("5 " + resourceIdentifier.getPublicId());
+
+        if (new File(new File(base).getParent(), resourceName).exists())
+            src.setByteStream(new File(new File(base).getParent(), 
resourceName).toURL().openStream());
+        else src.setByteStream(new File(_docRoot, 
resourceName).toURL().openStream());
+
+        return src;
+    }
 }

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java?view=diff&rev=451441&r1=451440&r2=451441
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/deploy/DocumentRegistry.java
 Fri Sep 29 14:13:16 2006
@@ -171,6 +171,9 @@
             // Add new schemas to our list.
             _schemas.putAll(capture);
           } catch (XsdException xsde) {
+              System.out.println("+++++++++++++++++++++++++++++++++");
+              xsde.printStackTrace();
+              System.out.println("+++++++++++++++++++++++++++++++++");
             __log.debug("captureSchemas: capture failed for " + docuri, xsde);
 
             LinkedList<XsdException> exceptions = new 
LinkedList<XsdException>();


Reply via email to