diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-27 08:41:59 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-27 08:41:59 +0000 |
commit | 1fdbfebde1bc14a4dcf93eb54083947a53615a45 (patch) | |
tree | 56046648539e0b9127db46bacbd9c0b6ece78704 /branches/sca-java-1.x/modules/binding-atom-js/src | |
parent | b61f7f0649bf7527c1a1691b71b0d61b17f8535c (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-atom-js/src')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/branches/sca-java-1.x/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java b/branches/sca-java-1.x/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java index 6c9abd8926..6b0170d2ce 100644 --- a/branches/sca-java-1.x/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java +++ b/branches/sca-java-1.x/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.binding.atom.js; import java.io.IOException; +import java.io.InputStream; import java.net.URI; import javax.xml.namespace.QName; @@ -31,7 +32,8 @@ import org.apache.tuscany.sca.core.web.JavascriptProxyFactory; public class AtomBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory { private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.atom"); - + private static final String JAVASCRIPT_FILE_NAME = "binding-atom.js"; + public Class<?> getModelType() { return AtomBinding.class; } @@ -39,8 +41,21 @@ public class AtomBindingJavascriptProxyFactoryImpl implements JavascriptProxyFac public QName getQName() { return NAME; } + + 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 scriptReference(ComponentReference componentReference) throws IOException { + public String createJavascriptReference(ComponentReference componentReference) throws IOException { Binding binding = componentReference.getBindings().get(0); URI targetURI = URI.create(binding.getURI()); String targetPath = targetURI.getPath(); |