Author: saminda
Date: Wed Aug  9 22:41:27 2006
New Revision: 430258

URL: http://svn.apache.org/viewvc?rev=430258&view=rev
Log:
updated project.properties to compile on 1.4 thus, the assert keyword be taken 
into action
added getInputStream() to Utils.
Updated ProxyService logic to get the correct input stream 


Modified:
    
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
    
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java
    incubator/synapse/trunk/java/project.properties

Modified: 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java?rev=430258&r1=430257&r2=430258&view=diff
==============================================================================
--- 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
 (original)
+++ 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
 Wed Aug  9 22:41:27 2006
@@ -29,6 +29,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
 
@@ -56,6 +57,27 @@
                 handleException("Error converting to a StreamSource", e);
             }
             
+        } else {
+            handleException("Cannot convert object to a StreamSource");
+        }
+        return null;
+    }
+
+    public static InputStream getInputStream(Object o) {
+
+        if (o == null) {
+            handleException("Cannot convert null to a StreamSource");
+
+        } else if (o instanceof OMElement) {
+            OMElement omElement = (OMElement) o;
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            try {
+                omElement.serialize(baos);
+                return new ByteArrayInputStream(baos.toByteArray());
+            } catch (XMLStreamException e) {
+                handleException("Error converting to a StreamSource", e);
+            }
+
         } else {
             handleException("Cannot convert object to a StreamSource");
         }

Modified: 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java?rev=430258&r1=430257&r2=430258&view=diff
==============================================================================
--- 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java
 (original)
+++ 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java
 Wed Aug  9 22:41:27 2006
@@ -34,8 +34,8 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.transform.stream.StreamSource;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.*;
 
@@ -88,28 +88,28 @@
         AxisService proxyService = null;
         if (wsdlKey != null) {
             try {
-                StreamSource wsdlStreamSource = 
Util.getStreamSource(synCfg.getProperty(wsdlKey));
+                InputStream wsdlInputStream = 
Util.getInputStream(synCfg.getProperty(wsdlKey));
                 // detect version of the WSDL 1.1 or 2.0
-                OMNamespace documentElementNS = new 
StAXOMBuilder(wsdlStreamSource.getInputStream()).
-                    getDocumentElement().getNamespace();
+                OMNamespace documentElementNS = new 
StAXOMBuilder(wsdlInputStream).getDocumentElement().getNamespace();
+
+                wsdlInputStream = 
Util.getInputStream(synCfg.getProperty(wsdlKey));
 
                 if (documentElementNS != null) {
                     WSDLToAxisServiceBuilder wsdlToAxisServiceBuilder = null;
                     if 
(WSDLConstants.WSDL20_2006Constants.DEFAULT_NAMESPACE_URI.
                         equals(documentElementNS.getNamespaceURI())) {
                         wsdlToAxisServiceBuilder =
-                            new WSDL20ToAxisServiceBuilder(
-                                wsdlStreamSource.getInputStream(), null, null);
+                            new WSDL20ToAxisServiceBuilder(wsdlInputStream, 
null, null);
 
                     } else if 
(org.apache.axis2.namespace.Constants.NS_URI_WSDL11.
                         equals(documentElementNS.getNamespaceURI())) {
                         wsdlToAxisServiceBuilder =
-                            new WSDL11ToAxisServiceBuilder(
-                                wsdlStreamSource.getInputStream(), null, null);
+                            new WSDL11ToAxisServiceBuilder(wsdlInputStream, 
null, null);
                     } else {
                         handleException("Unknown WSDL format.. not WSDL 1.1 or 
WSDL 2.0");
                     }
 
+                    assert wsdlToAxisServiceBuilder != null;
                     proxyService = wsdlToAxisServiceBuilder.populateService();
                     proxyService.setWsdlfound(true);
 
@@ -135,6 +135,7 @@
 
         // Set the name and description. Currently Axis2 uses the name as the
         // default Service destination
+        assert proxyService != null;
         proxyService.setName(name);
         if (description != null) {
             proxyService.setServiceDescription(description);
@@ -176,11 +177,11 @@
         }
 
         // if service level policies are specified, apply them
-        if (!serviceLevelPolicies.isEmpty()) {
+        /*if (!serviceLevelPolicies.isEmpty()) {
             PolicyReader reader = 
PolicyFactory.getPolicyReader(PolicyFactory.OM_POLICY_READER);
             Policy svcEffectivePolicy = null;
 
-            String policyKey = null;
+            String policyKey;
             iter = serviceLevelPolicies.iterator();
             while (iter.hasNext()) {
                 policyKey = (String) iter.next();
@@ -197,7 +198,7 @@
             policyInclude.addPolicyElement(PolicyInclude.SERVICE_POLICY, 
svcEffectivePolicy);
             proxyService.setPolicyInclude(policyInclude);
         }
-
+*/
         // create a custom message receiver for this proxy service to use a 
given named
         // endpoint or sequence for forwarding/message mediation
         ProxyServiceMessageReceiver msgRcvr = new 
ProxyServiceMessageReceiver();

Modified: incubator/synapse/trunk/java/project.properties
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/project.properties?rev=430258&r1=430257&r2=430258&view=diff
==============================================================================
--- incubator/synapse/trunk/java/project.properties (original)
+++ incubator/synapse/trunk/java/project.properties Wed Aug  9 22:41:27 2006
@@ -36,6 +36,8 @@
 # -------------------------------------------------------------------
 maven.compile.optimize=false
 maven.compile.fork=true
+maven.compile.target=1.4
+maven.compile.source=1.4
 
 # -------------------------------------------------------------------
 #                Versions of dependencies



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to