tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r400284 - in /incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino: assembly/ builder/ loader/
Date Sat, 06 May 2006 11:02:19 GMT
Author: antelder
Date: Sat May  6 04:02:15 2006
New Revision: 400284

URL: http://svn.apache.org/viewcvs?rev=400284&view=rev
Log:
Fix for TUSCANY-82/TUSCANY-221, No longer require style attribute as can be determined from
the component interface type

Modified:
    incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java
    incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java
    incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java

Modified: incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java?rev=400284&r1=400283&r2=400284&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java
(original)
+++ incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java
Sat May  6 04:02:15 2006
@@ -30,8 +30,6 @@
 
     private String scriptFile;
 
-    private String style;
-
     private String script;
 
     private ResourceLoader resourceLoader;
@@ -64,14 +62,6 @@
 
     public void setScriptFile(String fn) {
         scriptFile = fn;
-    }
-
-    public String getStyle() {
-        return this.style;
-    }
-
-    public void setStyle(String style) {
-        this.style = style;
     }
 
     public String getScript() {

Modified: incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java?rev=400284&r1=400283&r2=400284&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java
(original)
+++ incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java
Sat May  6 04:02:15 2006
@@ -23,10 +23,14 @@
 import org.apache.tuscany.container.rhino.config.JavaScriptContextFactory;
 import org.apache.tuscany.container.rhino.rhino.RhinoE4XScript;
 import org.apache.tuscany.container.rhino.rhino.RhinoScript;
+import org.apache.tuscany.core.builder.BuilderConfigException;
+import org.apache.tuscany.core.builder.BuilderException;
 import org.apache.tuscany.core.builder.ContextFactory;
 import org.apache.tuscany.core.extension.ContextFactoryBuilderSupport;
 import org.apache.tuscany.model.assembly.Scope;
 import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
 
 import commonj.sdo.helper.TypeHelper;
 
@@ -41,8 +45,22 @@
     @Override
     protected ContextFactory createContextFactory(String componentName, JavaScriptImplementation
jsImplementation, Scope scope) {
         Map<String, Class> services = new HashMap<String, Class>();
+
+        Boolean isWSDLService = null;
         for (Service service : jsImplementation.getComponentInfo().getServices()) {
-            services.put(service.getName(), service.getServiceContract().getInterface());
+            ServiceContract sc = service.getServiceContract();
+            if (sc instanceof WSDLServiceContract) {
+                if (isWSDLService != null && !isWSDLService.booleanValue()) {
+                    BuilderException e = new BuilderConfigException("mixed service interface
types not supportted");
+                    e.setIdentifier(componentName);
+                    throw e;
+                }
+                isWSDLService = Boolean.TRUE;
+            } else {
+                isWSDLService = Boolean.FALSE;
+            }
+
+            services.put(service.getName(), sc.getInterface());
         }
 
         Map<String, Object> defaultProperties = new HashMap<String, Object>();
@@ -54,7 +72,7 @@
         ClassLoader cl = jsImplementation.getResourceLoader().getClassLoader();
 
         RhinoScript invoker;
-        if ("e4x".equalsIgnoreCase(jsImplementation.getStyle())) { // TODO is constant "e4x"
somewhere?
+        if (Boolean.TRUE.equals(isWSDLService)) {
             TypeHelper typeHelper = jsImplementation.getTypeHelper();
             invoker = new RhinoE4XScript(componentName, script, defaultProperties, cl, typeHelper);
         } else {

Modified: incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java?rev=400284&r1=400283&r2=400284&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java
(original)
+++ incubator/tuscany/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java
Sat May  6 04:02:15 2006
@@ -75,14 +75,12 @@
 
     public JavaScriptImplementation load(XMLStreamReader reader, LoaderContext loaderContext)
throws XMLStreamException, ConfigurationLoadException {
         String scriptFile = reader.getAttributeValue(null, "scriptFile");
-        String style = reader.getAttributeValue(null, "style");
         String script = loadScript(scriptFile, loaderContext.getResourceLoader());
         ComponentInfo componentType = loadComponentType(scriptFile, loaderContext);
 
         JavaScriptImplementation jsImpl = new JavaScriptImplementation();
         jsImpl.setComponentInfo(componentType);
         jsImpl.setScriptFile(scriptFile);
-        jsImpl.setStyle(style);
         jsImpl.setScript(script);
         jsImpl.setResourceLoader(loaderContext.getResourceLoader());
         jsImpl.setTypeHelper(registry.getContext().getTypeHelper());



Mime
View raw message