summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-03-27 08:41:59 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-03-27 08:41:59 +0000
commit1fdbfebde1bc14a4dcf93eb54083947a53615a45 (patch)
tree56046648539e0b9127db46bacbd9c0b6ece78704 /branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache
parentb61f7f0649bf7527c1a1691b71b0d61b17f8535c (diff)
TUSCANY-2837 - Extending Javascript extension to provide the js proxy client file
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@759058 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache')
-rw-r--r--branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java b/branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java
index e0fda5c9f2..a396fe3bbf 100644
--- a/branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java
+++ b/branches/sca-java-1.x/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java
@@ -20,6 +20,7 @@
package org.apache.tuscany.sca.binding.jsonrpc.js;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import javax.xml.namespace.QName;
@@ -31,6 +32,7 @@ import org.apache.tuscany.sca.core.web.JavascriptProxyFactory;
public class JSONRPCBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory {
private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.jsonrpc");
+ private static final String JAVASCRIPT_FILE_NAME = "binding-jsonrpc.js";
public Class<?> getModelType() {
return JSONRPCBinding.class;
@@ -40,7 +42,20 @@ public class JSONRPCBindingJavascriptProxyFactoryImpl implements JavascriptProxy
return NAME;
}
- public String scriptReference(ComponentReference componentReference) throws IOException {
+ public String getJavascriptProxyFile() {
+ return JAVASCRIPT_FILE_NAME;
+ }
+
+ public InputStream getJavascriptProxyFileAsStream() throws IOException {
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream(JAVASCRIPT_FILE_NAME);
+ if (is == null) {
+ throw new IOException("Could not find Javascript '" + JAVASCRIPT_FILE_NAME + "'" );
+ }
+
+ return is;
+ }
+
+ public String createJavascriptReference(ComponentReference componentReference) throws IOException {
Binding binding = componentReference.getBindings().get(0);
URI targetURI = URI.create(binding.getURI());
String targetPath = targetURI.getPath();