You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by in...@apache.org on 2008/08/10 12:26:14 UTC

svn commit: r684446 [1/2] - in /synapse/trunk/java: modules/core/src/main/java/org/apache/synapse/registry/url/ repository/conf/sample/ repository/conf/sample/resources/script/ src/site/xdoc/ src/site/xdoc/1_0/

Author: indika
Date: Sun Aug 10 03:25:49 2008
New Revision: 684446

URL: http://svn.apache.org/viewvc?rev=684446&view=rev
Log:
fixed an issse with binary and plain text resources
update sample 350 to test it out

Added:
    synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js   (contents, props changed)
      - copied, changed from r684430, synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransform.js
    synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js
Removed:
    synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransform.js
Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java
    synapse/trunk/java/repository/conf/sample/synapse_sample_350.xml
    synapse/trunk/java/src/site/xdoc/1_0/samples.xml
    synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java?rev=684446&r1=684445&r2=684446&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java Sun Aug 10 03:25:49 2008
@@ -118,8 +118,10 @@
                 result = SynapseConfigUtils.readNonXML(url);
 
             } finally {
-
                 try {
+                    if (result != null && result.getParent() != null) {
+                        result.detach();
+                    }
                     inputStream.close();
                 } catch (IOException e) {
                     log.error("Error in closing the input stream.", e);

Copied: synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js (from r684430, synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransform.js)
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js?p2=synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js&p1=synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransform.js&r1=684430&r2=684446&rev=684446&view=diff
==============================================================================
--- synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransform.js (original)
+++ synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js Sun Aug 10 03:25:49 2008
@@ -27,16 +27,5 @@
         </m:getQuote>);
   }
 
-  function transformResponse(mc) {
-     var symbol = mc.getPayloadXML()..*::symbol.toString();
-     var price = mc.getPayloadXML()..*::last.toString();
-     mc.setPayloadXML(
-        <m:CheckPriceResponse xmlns:m="http://services.samples/xsd">
-	   <m:Code>{symbol}</m:Code>
-	   <m:Price>{price}</m:Price>
-        </m:CheckPriceResponse>);
-  }
-
-
 
 

Propchange: synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformRequest.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js?rev=684446&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js (added)
+++ synapse/trunk/java/repository/conf/sample/resources/script/stockquoteTransformResponse.js Sun Aug 10 03:25:49 2008
@@ -0,0 +1,33 @@
+/*<!--
+  ~  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.
+  -->*/
+      
+
+  function transformResponse(mc) {
+     var symbol = mc.getPayloadXML()..*::symbol.toString();
+     var price = mc.getPayloadXML()..*::last.toString();
+     mc.setPayloadXML(
+        <m:CheckPriceResponse xmlns:m="http://services.samples/xsd">
+	   <m:Code>{symbol}</m:Code>
+	   <m:Price>{price}</m:Price>
+        </m:CheckPriceResponse>);
+  }
+
+
+
+

Modified: synapse/trunk/java/repository/conf/sample/synapse_sample_350.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_350.xml?rev=684446&r1=684445&r2=684446&view=diff
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_350.xml (original)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_350.xml Sun Aug 10 03:25:49 2008
@@ -1,38 +1,49 @@
 <!--
-  ~  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
+  ~  Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
   ~
-  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~  WSO2 Inc. 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
+  ~  "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.
+  ~
   -->
-    
+
 <!-- Introduction to the script mediator using js scripts -->
 <definitions xmlns="http://ws.apache.org/ns/synapse">
-    <localEntry key="stockquoteScript" src="file:repository/conf/sample/resources/script/stockquoteTransform.js"/>
+
+    <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
+        <!-- the root property of the simple URL registry helps resolve a resource URL as root + key -->
+        <parameter name="root">file:repository/conf/sample/resources/</parameter>
+        <!-- all resources loaded from the URL registry would be cached for this number of milli seconds -->
+        <parameter name="cachableDuration">15000</parameter>
+    </registry>
+
+    <localEntry key="stockquoteScript"
+                src="file:repository/conf/sample/resources/script/stockquoteTransformRequest.js"/>
 
     <in>
         <!-- transform the custom quote request into a standard quote request expected by the service -->
         <script language="js" key="stockquoteScript" function="transformRequest"/>
         <send>
             <endpoint>
-                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+                <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
             </endpoint>
         </send>
     </in>
+
     <out>
         <!-- transform the standard response back into the custom format the client expects -->
-        <script language="js" key="stockquoteScript" function="transformResponse"/>
+        <script language="js" key="script/stockquoteTransformResponse.js"
+                function="transformResponse"/>
         <send/>
     </out>
 </definitions>

Modified: synapse/trunk/java/src/site/xdoc/1_0/samples.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/1_0/samples.xml?rev=684446&r1=684445&r2=684446&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/1_0/samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/1_0/samples.xml Sun Aug 10 03:25:49 2008
@@ -2927,7 +2927,7 @@
     </h2>
 <pre xml:space="preserve">&lt;!-- Introduction to the script mediator --&gt;
 &lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
-    &lt;localEntry key="stockquoteScript" src="file:repository/conf/sample/resources/script/stockquoteTransform.js"/&gt;
+    &lt;localEntry key="stockquoteScript" src="file:repository/conf/sample/resources/script/stockquoteTransformRequest.js"/&gt;
 
     &lt;in&gt;
         &lt;!-- transform the custom quote request into a standard quote request expected by the service --&gt;