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/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider | |
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/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider')
-rw-r--r-- | branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java b/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java index 0e56d25c51..40039f74c2 100644 --- a/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java +++ b/branches/sca-java-1.x/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java @@ -74,20 +74,18 @@ public class WidgetComponentScriptGenerator { for(ComponentReference reference : component.getReferences()) { for(Binding binding : reference.getBindings()) { - String [] bindingProxyNames = WidgetProxyHelper.getJavaScriptProxyFile(binding.getClass().getName()); + JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass()); + + String bindingProxyName = jsProxyFactory.getJavascriptProxyFile(); //check if binding client code was already processed and inject to the generated script - if ( bindingProxyNames != null ) { - for ( int i = 0; i < bindingProxyNames.length; i++ ) { - String bindingProxyName = bindingProxyNames[ i ]; - if(bindingProxyName != null) { - Boolean processedFlag = bindingClientProcessed.get(bindingProxyName); - if( processedFlag == null || processedFlag.booleanValue() == false) { - generateJavaScriptBindingProxy(pw,bindingProxyName); - bindingClientProcessed.put(bindingProxyName, Boolean.TRUE); - } - } + if(bindingProxyName != null) { + Boolean processedFlag = bindingClientProcessed.get(bindingProxyName); + if( processedFlag == null || processedFlag.booleanValue() == false) { + generateJavaScriptBindingProxy(jsProxyFactory, pw); + bindingClientProcessed.put(bindingProxyName, Boolean.TRUE); } } + } } @@ -124,9 +122,8 @@ public class WidgetComponentScriptGenerator { * Retrieve the binding proxy based on the bind name * and embedded the JavaScript into this js */ - private static void generateJavaScriptBindingProxy(PrintWriter pw, String bindingProxyName) throws IOException { - //FIXME: Handle the case where the JavaScript binding client is not found - InputStream is = WidgetComponentScriptGenerator.class.getClassLoader().getResourceAsStream(bindingProxyName); + private static void generateJavaScriptBindingProxy(JavascriptProxyFactory javascriptProxyFactory, PrintWriter pw) throws IOException { + InputStream is = javascriptProxyFactory.getJavascriptProxyFileAsStream(); if (is != null) { int i; while ((i = is.read()) != -1) { @@ -208,7 +205,7 @@ public class WidgetComponentScriptGenerator { String referenceName = reference.getName(); JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass()); - pw.println("tuscany.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.scriptReference(reference) + ";"); + pw.println("tuscany.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.createJavascriptReference(reference) + ";"); } } |