Author: mszefler
Date: Thu Dec 21 16:00:57 2006
New Revision: 489514
URL: http://svn.apache.org/viewvc?view=rev&rev=489514
Log:
Added missing files.
Added:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
(with props)
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java
(with props)
Added:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java?view=auto&rev=489514
==============================================================================
---
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
(added)
+++
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
Thu Dec 21 16:00:57 2006
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.ode.bpel.compiler;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Resolver implementation that restricts us to a known set of resources.
+ */
+class LocalEntityResolver implements EntityResolver {
+ private static final Log __log =
LogFactory.getLog(LocalEntityResolver.class);
+
+ private final HashMap<String, URL> _mappings = new HashMap<String,URL>();
+
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws SAXException, IOException {
+ if (__log.isTraceEnabled())
+ __log.trace("resolveEntity(" + publicId + "," + systemId + ")") ;
+
+ URL target = _mappings.get(systemId);
+ if (target == null)
+ target = _mappings.get(publicId);
+
+ if (target == null) {
+ if (__log.isDebugEnabled())
+ __log.debug("resolveEntity(" + publicId + "," + systemId +
+ ") failed (resource not found) ");
+ throw new IOException("Resource not found: " + publicId + " : " +
systemId);
+ }
+
+ if (__log.isDebugEnabled())
+ __log.debug("resolveEntity(" + publicId + "," + systemId +
+ ") ==> target" );
+
+ return new InputSource(target.openStream());
+ }
+
+
+ void register(String id, URL location) {
+ if (id == null)
+ throw new NullPointerException("id arg must not be null!");
+ if (location == null)
+ throw new NullPointerException("location arg must not be null");
+
+ if (__log.isDebugEnabled())
+ __log.debug("mapping " + id + " ==> " + location);
+ _mappings.put(id, location);
+ }
+}
Propchange:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java?view=auto&rev=489514
==============================================================================
---
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java
(added)
+++
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java
Thu Dec 21 16:00:57 2006
@@ -0,0 +1,56 @@
+package org.apache.ode.bpel.compiler;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+
+import javax.wsdl.xml.WSDLLocator;
+
+import org.xml.sax.InputSource;
+
+public class WSDLLocatorImpl implements WSDLLocator {
+
+ private ResourceFinder _resourceFinder;
+ private URI _base;
+ private String _latest;
+
+ public WSDLLocatorImpl(ResourceFinder resourceFinder, URI base) {
+ _resourceFinder = resourceFinder;
+ _base = base;
+ }
+
+ public InputSource getBaseInputSource() {
+ try {
+ InputSource is = new InputSource();
+ is.setByteStream(_resourceFinder.openResource(_base));
+ is.setSystemId(_base.toString());
+ return is;
+ } catch (MalformedURLException e) {
+ return null;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ public InputSource getImportInputSource(String parent, String imprt) {
+ URI uri = parent == null ? _base.resolve(imprt) :
_base.resolve(parent).resolve(imprt);
+ InputSource is = new InputSource();
+ try {
+ is.setByteStream(_resourceFinder.openResource(uri));
+ } catch (Exception e) {
+ return null;
+ }
+ is.setSystemId(uri.toString());
+ _latest = uri.toString();
+ return is;
+ }
+
+ public String getBaseURI() {
+ return _base.toString();
+ }
+
+ public String getLatestImportURI() {
+ return _latest;
+ }
+
+}
Propchange:
incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/WSDLLocatorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native