tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r512056 - in /incubator/tuscany/branches/sca-java-integration/sca: extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/ ex...
Date Mon, 26 Feb 2007 22:53:29 GMT
Author: antelder
Date: Mon Feb 26 14:53:28 2007
New Revision: 512056

URL: http://svn.apache.org/viewvc?view=rev&rev=512056
Log:
Start at supporting script component properties without requiring a .componentType side file
(also add a few missing ASL headers)

Added:
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
  (with props)
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js
  (with props)
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py
  (with props)
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb
Modified:
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType
    incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PropertiesTestCase.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentBuilder.java
Mon Feb 26 14:53:28 2007
@@ -54,7 +54,7 @@
             // if its not a Java interface assume WSDL and want XML databinding
             ServiceContract contract = service.getServiceContract();
             if (!(contract instanceof JavaServiceContract)) {
-                service.getServiceContract().setDataBinding("org.mozilla.javascript.xml.XMLObject");
+                service.getServiceContract().setDataBinding("org.mozilla.javascript.xmlimpl.XML");
             }
         }
 

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptComponentType.java
Mon Feb 26 14:53:28 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.container.script;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.spi.model.ComponentType;
 import org.apache.tuscany.spi.model.Property;
 import org.apache.tuscany.spi.model.ReferenceDefinition;
@@ -25,8 +27,8 @@
 import org.apache.tuscany.spi.model.ServiceDefinition;
 
 /**
- * A componentType for script components
- * TODO: need lifecycle methods init/destroy 
+ * A componentType for script components TODO: need lifecycle methods
+ * init/destroy
  */
 public class ScriptComponentType extends ComponentType<ServiceDefinition, ReferenceDefinition,
Property<?>> {
 
@@ -34,4 +36,12 @@
         this.implementationScope = Scope.COMPOSITE;
     }
 
+    @Override
+    public Property getProperty(String name) {
+        Property p = super.getProperty(name);
+        if (p == null) {
+            p = new Property<Object>(name, new QName("http://www.w3.org/2001/XMLSchema",
"any"), null);
+        }
+        return p;
+    }
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
Mon Feb 26 14:53:28 2007
@@ -41,10 +41,7 @@
     private Map<String, ObjectFactory> contextObjects;
     private Map<String, Class> contextTypes;
 
-    public ScriptInstanceFactory(String resourceName,
-                                 String className,
-                                 String scriptSource,
-                                 ClassLoader classLoader) {
+    public ScriptInstanceFactory(String resourceName, String className, String scriptSource,
ClassLoader classLoader) {
         this.resourceName = resourceName;
         this.classLoader = classLoader;
         this.className = className;
@@ -54,17 +51,18 @@
     }
 
     /**
-     * Create a new invokeable instance of the script
-     * <p/>
-     * objects to add to scope of the script instance
-     *
+     * Create a new invokeable instance of the script <p/> objects to add to
+     * scope of the script instance
+     * 
      * @return a RhinoScriptInstance
      */
-    //public ScriptInstanceImpl createInstance(List<Class<?>> serviceBindings,
Map<String, Object> context) {
+    // public ScriptInstanceImpl createInstance(List<Class<?>> serviceBindings,
+    // Map<String, Object> context) {
     public ScriptInstance getInstance() throws ObjectCreationException {
         try {
 
-            //TODO: this uses a new manager and recompiles the scrip each time, may be able
to optimize
+            // TODO: this uses a new manager and recompiles the scrip each time,
+            // may be able to optimize
             // but need to be careful about instance scoping
 
             BSFManager bsfManager = new BSFManager();
@@ -86,6 +84,19 @@
             String scriptLanguage = BSFManager.getLangFromFilename(resourceName);
             BSFEngine bsfEngine = bsfManager.loadScriptingEngine(scriptLanguage);
             bsfEngine.exec(resourceName, 0, 0, scriptSource);
+
+            // register any context objects (SCA properties and references)
+            for (Map.Entry<String, ObjectFactory> entry : contextObjects.entrySet())
{
+                Object value = entry.getValue().getInstance();
+                Class type = contextTypes.get(entry.getKey());
+                if (type == null) {
+                    type = value.getClass();
+                }
+                // TODO: Hack to bypass bug in BSF javascript engine
+                if (!("javascript".equals(scriptLanguage)) || (value instanceof Number) ||
(value instanceof String) || (value instanceof Boolean)) {
+                    bsfManager.declareBean(entry.getKey(), value, type);
+                }
+            }
 
             // if there's a className then get the class object
             Object clazz = null;

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
Mon Feb 26 14:53:28 2007
@@ -1,5 +1,6 @@
 package org.apache.tuscany.container.script.mock;
 
+import org.apache.bsf.BSFDeclaredBean;
 import org.apache.bsf.BSFException;
 import org.apache.bsf.util.BSFEngineImpl;
 
@@ -24,4 +25,6 @@
         return null;
     }
 
+    public void declareBean(BSFDeclaredBean bean) throws BSFException {
+    }
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4X2Object.java
Mon Feb 26 14:53:28 2007
@@ -20,7 +20,6 @@
 
 import org.apache.tuscany.spi.databinding.Transformer;
 import org.apache.tuscany.spi.databinding.extension.SimpleType2JavaTransformer;
-import org.mozilla.javascript.xml.XMLObject;
 import org.mozilla.javascript.xmlimpl.XML;
 import org.osoa.sca.annotations.Service;
 
@@ -42,6 +41,6 @@
     }
 
     public Class getSourceType() {
-        return XMLObject.class;
+        return XML.class;
     }
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/E4XDataBinding.java
Mon Feb 26 14:53:28 2007
@@ -22,7 +22,7 @@
 import org.apache.tuscany.spi.databinding.DataBinding;
 import org.apache.tuscany.spi.databinding.WrapperHandler;
 import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
-import org.mozilla.javascript.xml.XMLObject;
+import org.mozilla.javascript.xmlimpl.XML;
 import org.osoa.sca.annotations.Service;
 
 /**
@@ -33,11 +33,11 @@
 @Service(DataBinding.class)
 public class E4XDataBinding extends DataBindingExtension {
     
-    public static final String NAME = XMLObject.class.getName();
+    public static final String NAME = XML.class.getName();
     public static final String[] ALIASES = new String[] {"e4x"};
 
     public E4XDataBinding() {
-        super(NAME, ALIASES, XMLObject.class);
+        super(NAME, ALIASES, XML.class);
     }
 
     /**

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/databinding.e4x/src/main/java/org/apache/tuscany/extensions/script/databinding/e4x/Object2E4X.java
Mon Feb 26 14:53:28 2007
@@ -26,7 +26,6 @@
 import org.apache.tuscany.spi.databinding.TransformationContext;
 import org.apache.tuscany.spi.databinding.Transformer;
 import org.apache.tuscany.spi.databinding.extension.Java2SimpleTypeTransformer;
-import org.mozilla.javascript.xml.XMLObject;
 import org.mozilla.javascript.xmlimpl.XML;
 import org.osoa.sca.annotations.Service;
 
@@ -52,7 +51,7 @@
 
     @Override
     public Class getTargetType() {
-        return XMLObject.class;
+        return XML.class;
     }
 
 }

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/properties.composite
Mon Feb 26 14:53:28 2007
@@ -18,7 +18,8 @@
  * under the License.    
 -->
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
-
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+           
            name="ScriptItests">
     
     <component name="HelloWorldJSDefaultComponent">
@@ -30,6 +31,15 @@
         <property name="GREETING">Namaskaar</property>
     </component>
 
+    <component name="HelloWorldJSDynDefaultComponent">
+        <implementation.script script="properties/helloworldDyn.js"/>
+    </component>
+
+    <component name="HelloWorldJSDynOverrideComponent">
+        <implementation.script script="properties/helloworldDyn.js"/>
+        <property name="GREETING">Namaste</property>
+    </component>
+
     <component name="HelloWorldRubyDefaultComponent">
         <implementation.script script="properties/helloworld.rb"/>
     </component>
@@ -39,6 +49,15 @@
         <property name="GREETING">Namaskaar</property>
     </component>
 
+    <component name="HelloWorldRubyDynDefaultComponent">
+        <implementation.script script="properties/helloworldDyn.rb"/>
+    </component>
+
+    <component name="HelloWorldRubyDynOverrideComponent">
+        <implementation.script script="properties/helloworldDyn.rb"/>
+        <property name="GREETING">Namaste</property>
+    </component>
+
     <component name="HelloWorldPythonDefaultComponent">
         <implementation.script script="properties/helloworld.py"/>
     </component>
@@ -46,6 +65,15 @@
     <component name="HelloWorldPythonOverrideComponent">
         <implementation.script script="properties/helloworld.py"/>
         <property name="GREETING">Namaskaar</property>
+    </component>
+
+    <component name="HelloWorldPythonDynDefaultComponent">
+        <implementation.script script="properties/helloworldDyn.py"/>
+    </component>
+
+    <component name="HelloWorldPythonDynOverrideComponent">
+        <implementation.script script="properties/helloworldDyn.py"/>
+        <property name="GREETING">Namaste</property>
     </component>
 
 </composite>

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/CalculatorImpl.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="CalculatorService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/calculator/DivideImpl.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="DivideService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/helloworld/helloworld.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="HelloWorldService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="HelloWorldService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworld.js
Mon Feb 26 14:53:28 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
- 
+
 function getGreetings(s) {
    return "js" + GREETING + " " + s;
 }

Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType?view=auto&rev=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
(added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
Mon Feb 26 14:53:28 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+  <service name="HelloWorldService">
+        <interface.java class="helloworld.HelloWorldService" />
+  </service>
+
+</componentType>              
+       
\ No newline at end of file

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.componentType
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js?view=auto&rev=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js
(added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js
Mon Feb 26 14:53:28 2007
@@ -0,0 +1,24 @@
+/*
+ * 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.    
+ */
+
+var GREETING = "Yo!";
+
+function getGreetings(s) {
+   return "js" + GREETING + " " + s;
+}
\ No newline at end of file

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py?view=auto&rev=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py
(added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py
Mon Feb 26 14:53:28 2007
@@ -0,0 +1,21 @@
+# 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.
+
+GREETING = "Yo!"
+
+def getGreetings(s):
+   return "py" + GREETING + " " + s
\ No newline at end of file

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.py
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb?view=auto&rev=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb
(added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/properties/helloworldDyn.rb
Mon Feb 26 14:53:28 2007
@@ -0,0 +1,23 @@
+# 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.
+
+$GREETING = "Yo!"
+
+def getGreetings(s) 
+   return "rb" + $GREETING + " " + s
+end
+

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="HelloWorldService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworld.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="HelloWorldService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXML.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="HelloWorldService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/xml/helloworldXMLProxy.componentType
Mon Feb 26 14:53:28 2007
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
 <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
 
   <service name="HelloWorldService">

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PropertiesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PropertiesTestCase.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PropertiesTestCase.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/PropertiesTestCase.java
Mon Feb 26 14:53:28 2007
@@ -22,6 +22,8 @@
 import junit.framework.Assert;
 
 import org.apache.tuscany.test.SCATestCase;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
 import org.osoa.sca.CompositeContext;
 import org.osoa.sca.CurrentCompositeContext;
 
@@ -30,7 +32,7 @@
  */
 public class PropertiesTestCase extends SCATestCase {
 
-    private CompositeContext compositeContext;
+     private CompositeContext compositeContext;
 
     public void testJavaScriptDefault() throws Exception {
         HelloWorldService helloWorldService =
@@ -46,6 +48,20 @@
         Assert.assertEquals("jsNamaskaar Petra", msg);
     }
 
+    public void testJavaScriptDynDefault() throws Exception {
+        HelloWorldService helloWorldService =
+            compositeContext.locateService(HelloWorldService.class, "HelloWorldJSDynDefaultComponent");
+        String msg = helloWorldService.getGreetings("Petra");
+        Assert.assertEquals("jsYo! Petra", msg);
+    }
+
+    public void testJavaScriptDynOverride() throws Exception {
+        HelloWorldService helloWorldService =
+            compositeContext.locateService(HelloWorldService.class, "HelloWorldJSDynOverrideComponent");
+        String msg = helloWorldService.getGreetings("Petra");
+        Assert.assertEquals("jsNamaste Petra", msg);
+    }
+
     public void testPythonDefault() throws Exception {
         HelloWorldService helloWorldService =
             compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonDefaultComponent");
@@ -59,6 +75,20 @@
         Assert.assertEquals("pyNamaskaar Petra", msg);
     }
 
+    public void testPythonDynDefault() throws Exception {
+        HelloWorldService helloWorldService =
+            compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonDynDefaultComponent");
+        String msg = helloWorldService.getGreetings("Petra");
+        Assert.assertEquals("pyYo! Petra", msg);
+    }
+
+    public void testPythonDynOverride() throws Exception {
+        HelloWorldService helloWorldService =
+            compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonDynOverrideComponent");
+        String msg = helloWorldService.getGreetings("Petra");
+        Assert.assertEquals("pyNamaste Petra", msg);
+    }
+
     public void testRubyDefault() throws Exception {
         HelloWorldService helloWorldService =
             compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyDefaultComponent");
@@ -70,6 +100,19 @@
             compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyOverrideComponent");
         String msg = helloWorldService.getGreetings("Petra");
         Assert.assertEquals("rbNamaskaar Petra", msg);
+    }
+
+    public void testRubyDynDefault() throws Exception {
+        HelloWorldService helloWorldService =
+            compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyDynDefaultComponent");
+        String msg = helloWorldService.getGreetings("Petra");
+        Assert.assertEquals("rbYo! Petra", msg);
+    }
+    public void testRubyDynOverride() throws Exception {
+        HelloWorldService helloWorldService =
+            compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyDynOverrideComponent");
+        String msg = helloWorldService.getGreetings("Petra");
+        Assert.assertEquals("rbNamaste Petra", msg);
     }
 
     @Override

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ComponentLoader.java
Mon Feb 26 14:53:28 2007
@@ -192,7 +192,7 @@
         String name = reader.getAttributeValue(null, PROPERTY_NAME_ATTR);
         Implementation<?> implementation = componentDefinition.getImplementation();
         ComponentType<?, ?, ?> componentType = implementation.getComponentType();
-        Property<Type> property = (Property<Type>) componentType.getProperties().get(name);
+        Property<Type> property = componentType.getProperty(name);
         if (property == null) {
             throw new UndefinedPropertyException(name);
         }

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java?view=diff&rev=512056&r1=512055&r2=512056
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
Mon Feb 26 14:53:28 2007
@@ -175,4 +175,14 @@
     public void add(P property) {
         properties.put(property.getName(), property);
     }
+
+    /**
+     * Get a specific property that can be used to configure the implementation.
+     * 
+     * @param name the name of the property
+     * @return the property that can be used to configure the implementation or null if no
such property exists
+     */
+    public Property getProperty(String name) {
+        return properties.get(name);
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message