You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2008/04/18 19:57:13 UTC
svn commit: r649628 - in
/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util:
DataObjectUtil.java resource/SDOURIConverterImpl.java
Author: rfeng
Date: Fri Apr 18 10:57:10 2008
New Revision: 649628
URL: http://svn.apache.org/viewvc?rev=649628&view=rev
Log:
Fix for TUSCANY-2240
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOURIConverterImpl.java
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java?rev=649628&r1=649627&r2=649628&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java Fri Apr 18 10:57:10 2008
@@ -44,6 +44,7 @@
import org.apache.tuscany.sdo.impl.DataGraphImpl;
import org.apache.tuscany.sdo.model.ModelFactory;
import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+import org.apache.tuscany.sdo.util.resource.SDOURIConverterImpl;
import org.apache.tuscany.sdo.util.resource.SDOXMLResourceFactoryImpl;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.URI;
@@ -2591,7 +2592,7 @@
{
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().putAll(getRegistrations());
resourceSet.setPackageRegistry(new EPackageRegistryImpl(HelperContextImpl.getBuiltInModelRegistry()));
-// resourceSet.setURIConverter(new SDOURIConverterImpl());
+ resourceSet.setURIConverter(new SDOURIConverterImpl());
}
public static EClass createDocumentRoot()
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOURIConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOURIConverterImpl.java?rev=649628&r1=649627&r2=649628&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOURIConverterImpl.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/resource/SDOURIConverterImpl.java Fri Apr 18 10:57:10 2008
@@ -27,29 +27,34 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.URIConverterImpl;
-public class SDOURIConverterImpl extends URIConverterImpl
-{
- /**
- * Disable going out to the wire.
- */
- protected InputStream createURLInputStream(URI uri) throws IOException {
- String scheme = uri.scheme();
- if ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) {
- throw new Resource.IOWrappedException(
- new RuntimeException("Reading remote URL not supported."));
- }
- return super.createURLInputStream(uri);
- }
-
- /**
- * Disable going out to the wire.
- */
- protected OutputStream createURLOutputStream(URI uri) throws IOException {
- String scheme = uri.scheme();
- if ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) {
- throw new Resource.IOWrappedException(
- new RuntimeException("Writing remote URL not supported."));
- }
- return super.createURLOutputStream(uri);
- }
+public class SDOURIConverterImpl extends URIConverterImpl {
+ /**
+ * Disable going out to the wire.
+ */
+ protected InputStream createURLInputStream(URI uri) throws IOException {
+ String scheme = uri.scheme();
+ if ("http".equals(scheme) || "https".equals(scheme)) {
+ // TUSCANY 2240: We need to compromise if the remote loading is allowed or not
+ String ext = uri.fileExtension();
+ if (!"wsdl".equalsIgnoreCase(ext) && !"xsd".equalsIgnoreCase(ext)) {
+ throw new Resource.IOWrappedException(new RuntimeException("Reading remote URL not supported: " + uri));
+ }
+ }
+ return super.createURLInputStream(uri);
+ }
+
+ /**
+ * Disable going out to the wire.
+ */
+ protected OutputStream createURLOutputStream(URI uri) throws IOException {
+ String scheme = uri.scheme();
+ if ("http".equals(scheme) || "https".equals(scheme)) {
+ // TUSCANY 2240: We need to compromise if the remote loading is allowed or not
+ String ext = uri.fileExtension();
+ if (!"wsdl".equalsIgnoreCase(ext) && !"xsd".equalsIgnoreCase(ext)) {
+ throw new Resource.IOWrappedException(new RuntimeException("Reading remote URL not supported: " + uri));
+ }
+ }
+ return super.createURLOutputStream(uri);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org