You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/03/25 11:29:22 UTC

svn commit: r522186 [1/3] - in /incubator/tuscany/sandbox/sebastien/java/sca/modules: ./ assembly/src/main/java/org/apache/tuscany/assembly/model/ assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ assembly/src/main/java/org/apache/tuscany/...

Author: jsdelfino
Date: Sun Mar 25 02:29:19 2007
New Revision: 522186

URL: http://svn.apache.org/viewvc?view=rev&rev=522186
Log:
Added a prototype of a variant implementation of the assembly model interfaces backed by spring bean definitions, illustrating pluggability of the model modules. Added an SCABinding interface+class. Minor cleanup of the factory names and the wiring util.

Added:
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/main/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/main/java/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorTestCase.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/VariantRuntimeContext.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/VariantRuntimeException.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/resources/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/resources/Calculator.composite   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/LICENSE.txt   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/NOTICE.txt   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/pom.xml   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/context/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/context/CompositeApplicationContext.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/context/DummyCompositeReferenceBean.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/context/DummyCompositeServiceBean.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/impl/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/impl/BeanAssemblyFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/impl/BeanComponentImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/bean/impl/BeanReferenceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/java/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/java/bean/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/java/bean/impl/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/java/bean/impl/BeanJavaFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/java/bean/impl/BeanJavaImplementationImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/main/java/org/apache/tuscany/java/bean/impl/BeanJavaInterfaceImpl.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/test/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/test/java/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/bean/src/test/resources/
    incubator/tuscany/sandbox/sebastien/java/sca/modules/crud/src/main/java/org/apache/tuscany/crud/model/impl/DefaultCRUDFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/java/src/main/java/org/apache/tuscany/java/model/impl/DefaultJavaFactory.java   (with props)
    incubator/tuscany/sandbox/sebastien/java/sca/modules/wsdl/src/main/java/org/apache/tuscany/wsdl/model/impl/DefaultWSDLFactory.java   (with props)
Removed:
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/AssemblyFactoryImpl.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/crud/src/main/java/org/apache/tuscany/crud/model/impl/CRUDFactoryImpl.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/wsdl/src/main/java/org/apache/tuscany/wsdl/model/impl/WSDLFactoryImpl.java
Modified:
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/AssemblyFactory.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/Contract.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/crud-scdl/src/test/java/org/apache/tuscany/crud/scdl/ReadTestCase.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/crud/src/test/java/org/apache/tuscany/crud/model/CRUDFactoryTestCase.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/pom.xml
    incubator/tuscany/sandbox/sebastien/java/sca/modules/scdl/src/main/java/org/apache/tuscany/scdl/impl/ComponentTypeHandler.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/scdl/src/main/java/org/apache/tuscany/scdl/impl/CompositeHandler.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/scdl/src/main/java/org/apache/tuscany/scdl/impl/ConstrainingTypeHandler.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/scdl/src/test/java/org/apache/tuscany/scdl/ReadTestCase.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/scdl/src/test/java/org/apache/tuscany/scdl/WriteTestCase.java
    incubator/tuscany/sandbox/sebastien/java/sca/modules/wsdl-scdl/src/test/java/org/apache/tuscany/scdl/wsdl/ReadTestCase.java

Modified: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/AssemblyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/AssemblyFactory.java?view=diff&rev=522186&r1=522185&r2=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/AssemblyFactory.java (original)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/AssemblyFactory.java Sun Mar 25 02:29:19 2007
@@ -125,4 +125,9 @@
 	 */
 	Wire createWire();
 
+	/**
+	 * Create a new SCA binding.
+	 * @return a new SCA binding
+	 */
+	SCABinding createSCABinding();
 }

Modified: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/Contract.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/Contract.java?view=diff&rev=522186&r1=522185&r2=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/Contract.java (original)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/Contract.java Sun Mar 25 02:29:19 2007
@@ -35,6 +35,15 @@
     List<Binding> getBindings();
     
     /**
+     * Returns a binding of the specified type or null if there is no such binding
+     * configured on this contract.
+     * @param <B> the binding type
+     * @param bindingClass the binding type class
+     * @return the binding or null if there is no binding of the specified type
+     */
+    <B> B getBinding(Class<B> bindingClass);
+    
+    /**
      * Returns a callback definition of the bindings to use for callbacks. 
      * @return a definition of the bindings to use for callbacks
      */

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,28 @@
+/*
+ * 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.    
+ */
+package org.apache.tuscany.assembly.model;
+
+/**
+ * Represents an SCA binding.
+ *
+ *  @version $Rev$ $Date$
+ */
+public interface SCABinding extends Binding {
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/SCABinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,120 @@
+/*
+ * 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.    
+ */
+
+package org.apache.tuscany.assembly.model.impl;
+
+import org.apache.tuscany.assembly.model.AbstractProperty;
+import org.apache.tuscany.assembly.model.AbstractReference;
+import org.apache.tuscany.assembly.model.AbstractService;
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.Callback;
+import org.apache.tuscany.assembly.model.Component;
+import org.apache.tuscany.assembly.model.ComponentProperty;
+import org.apache.tuscany.assembly.model.ComponentReference;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.ComponentType;
+import org.apache.tuscany.assembly.model.Composite;
+import org.apache.tuscany.assembly.model.CompositeReference;
+import org.apache.tuscany.assembly.model.CompositeService;
+import org.apache.tuscany.assembly.model.ConstrainingType;
+import org.apache.tuscany.assembly.model.Property;
+import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.assembly.model.SCABinding;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.assembly.model.Wire;
+
+/**
+ * A factory for the assembly model.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class DefaultAssemblyFactory implements AssemblyFactory {
+
+	public AbstractProperty createAbstractProperty() {
+		return new AbstractPropertyImpl();
+	}
+
+	public AbstractReference createAbstractReference() {
+		return new AbstractReferenceImpl();
+	}
+
+	public AbstractService createAbstractService() {
+		return new AbstractServiceImpl();
+	}
+	
+	public Callback createCallback() {
+		return new CallbackImpl();
+	}
+
+	public Component createComponent() {
+		return new ComponentImpl();
+	}
+
+	public ComponentProperty createComponentProperty() {
+		return new ComponentPropertyImpl();
+	}
+
+	public ComponentReference createComponentReference() {
+		return new ComponentReferenceImpl();
+	}
+
+	public ComponentService createComponentService() {
+		return new ComponentServiceImpl();
+	}
+
+	public ComponentType createComponentType() {
+		return new ComponentTypeImpl();
+	}
+
+	public Composite createComposite() {
+		return new CompositeImpl();
+	}
+
+	public CompositeReference createCompositeReference() {
+		return new CompositeReferenceImpl();
+	}
+
+	public CompositeService createCompositeService() {
+		return new CompositeServiceImpl();
+	}
+
+	public ConstrainingType createConstrainingType() {
+		return new ConstrainingTypeImpl();
+	}
+
+	public Property createProperty() {
+		return new PropertyImpl();
+	}
+
+	public Reference createReference() {
+		return new ReferenceImpl();
+	}
+
+	public Service createService() {
+		return new ServiceImpl();
+	}
+
+	public Wire createWire() {
+		return new WireImpl();
+	}
+
+	public SCABinding createSCABinding() {
+		return new SCABindingImpl();
+	}
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/DefaultAssemblyFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java?view=diff&rev=522186&r1=522185&r2=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java (original)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java Sun Mar 25 02:29:19 2007
@@ -43,6 +43,15 @@
 	public List<Binding> getBindings() {
 		return bindings;
 	}
+	
+	public <B> B getBinding(Class<B> bindingClass) {
+		for (Binding binding: bindings) {
+			if (bindingClass.isInstance(binding)) {
+				return bindingClass.cast(binding);
+			}
+		}
+		return null;
+	}
 
 	public boolean isWiredByImpl() {
 		return wiredByImpl;

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.    
+ */
+package org.apache.tuscany.assembly.model.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.assembly.model.SCABinding;
+import org.apache.tuscany.policy.model.Intent;
+import org.apache.tuscany.policy.model.PolicySet;
+
+/**
+ * Represents an SCA binding.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class SCABindingImpl extends BaseImpl implements SCABinding {
+
+	private String name;
+	private String uri;
+	private List<Intent> requiredIntents = new ArrayList<Intent>();
+	private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public String getURI() {
+		return uri;
+	}
+	
+	public void setURI(String uri) {
+		this.uri = uri;
+	}
+
+	public List<Intent> getRequiredIntents() {
+		return requiredIntents;
+	}
+
+	public List<PolicySet> getPolicySets() {
+		return policySets;
+	}
+	
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/SCABindingImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java?view=diff&rev=522186&r1=522185&r2=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java (original)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java Sun Mar 25 02:29:19 2007
@@ -41,6 +41,15 @@
 		return bindings;
 	}
 
+	public <B> B getBinding(Class<B> bindingClass) {
+		for (Binding binding: bindings) {
+			if (bindingClass.isInstance(binding)) {
+				return bindingClass.cast(binding);
+			}
+		}
+		return null;
+	}
+
 	public List<PolicySet> getPolicySets() {
 		return policySets;
 	}

Modified: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java?view=diff&rev=522186&r1=522185&r2=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java (original)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java Sun Mar 25 02:29:19 2007
@@ -33,6 +33,7 @@
 import org.apache.tuscany.assembly.model.CompositeService;
 import org.apache.tuscany.assembly.model.Implementation;
 import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.assembly.model.SCABinding;
 import org.apache.tuscany.assembly.model.Service;
 import org.apache.tuscany.assembly.model.Wire;
 
@@ -128,20 +129,38 @@
 	
 	private void wire(List<Base> problems) {
 		
-		// Index all component services and references
+		// Index and bind all component services and references
 		Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
 		Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
 		for (Component component: composite.getComponents()) {
-			int i = 0;
 			for (ComponentService componentService: component.getServices()) {
-				if (i == 0) {
-					componentServices.put(component.getName(), componentService);
+				String uri;
+				if (componentService.getName() != null) {
+					uri = component.getName() + '/' + componentService.getName();
+				} else {
+					uri = component.getName();
+				}
+				componentServices.put(uri, componentService);
+				
+				// Create and configure an SCA binding for the service
+				SCABinding scaBinding = componentService.getBinding(SCABinding.class);
+				if (scaBinding == null) {
+					scaBinding = assemblyFactory.createSCABinding();
+					componentService.getBindings().add(scaBinding);
 				}
-				i++;
-				componentServices.put(component.getName() + '/' + componentService.getName(), componentService);
+				scaBinding.setURI(uri);
 			}
 			for (ComponentReference componentReference: component.getReferences()) {
-				componentReferences.put(component.getName() + '/' + componentReference.getName(), componentReference);
+				String uri = component.getName() + '/' + componentReference.getName();
+				componentReferences.put(uri, componentReference);
+
+				// Create and configure an SCA binding for the reference
+				SCABinding scaBinding = componentReference.getBinding(SCABinding.class);
+				if (scaBinding == null) {
+					scaBinding = assemblyFactory.createSCABinding();
+					componentReference.getBindings().add(scaBinding);
+				}
+				scaBinding.setURI(uri);
 			}
 		}
 		
@@ -177,14 +196,30 @@
 		// Wire references to their targets
 		for (ComponentReference componentReference: componentReferences.values()) {
 			List<ComponentService> targets = componentReference.getTargets();
-			for (int i = 0, n = targets.size(); i < n; i++) {
-				ComponentService target = targets.get(i);
-				if (target.isUnresolved()) {
-					ComponentService resolved = componentServices.get(target.getName());
-					if (resolved != null) {
-						targets.set(i, resolved);
-					} else {
-						problems.add(target);
+			if (!targets.isEmpty()) {
+				for (int i = 0, n = targets.size(); i < n; i++) {
+					ComponentService target = targets.get(i);
+					if (target.isUnresolved()) {
+						ComponentService resolved = componentServices.get(target.getName());
+						if (resolved != null) {
+							targets.set(i, resolved);
+						} else {
+							problems.add(target);
+						}
+					}
+				}
+			}
+			else if (componentReference.getReference() != null) {
+
+				// Wire reference targets from the corresponding reference in the componentType
+				for (ComponentService target: componentReference.getReference().getTargets()) {
+					if (target.isUnresolved()) {
+						ComponentService resolved = componentServices.get(target.getName());
+						if (resolved != null) {
+							targets.add(resolved);
+						} else {
+							problems.add(target);
+						}
 					}
 				}
 			}

Modified: incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java?view=diff&rev=522186&r1=522185&r2=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java (original)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java Sun Mar 25 02:29:19 2007
@@ -22,7 +22,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.assembly.model.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.assembly.model.impl.DefaultAssemblyFactory;
 
 /**
  * Test building of assembly model instances using the assembly factory.
@@ -34,7 +34,7 @@
 	AssemblyFactory factory;
 
 	public void setUp() throws Exception {
-		factory = new AssemblyFactoryImpl();
+		factory = new DefaultAssemblyFactory();
 	}
 
 	public void tearDown() throws Exception {

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt Sun Mar 25 02:29:19 2007
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt Sun Mar 25 02:29:19 2007
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/NOTICE.txt
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml Sun Mar 25 02:29:19 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<project>
+    <parent>
+        <groupId>org.apache.tuscany.sca.modules</groupId>
+        <artifactId>parent</artifactId>
+        <version>0.1-sandbox-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>tuscany-assembly-bean-test</artifactId>
+    <name>Apache Tuscany Assembly Model Variant Test</name>
+    <description>Test of a prototype of the SCA Assembly Model backed by Spring bean definitions</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.osoa</groupId>
+            <artifactId>sca-api-r1.0</artifactId>
+            <version>0.1-sandbox-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca.modules</groupId>
+            <artifactId>tuscany-assembly-bean</artifactId>
+            <version>0.1-sandbox-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca.modules</groupId>
+            <artifactId>tuscany-assembly-scdl</artifactId>
+            <version>0.1-sandbox-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca.modules</groupId>
+            <artifactId>tuscany-java-scdl</artifactId>
+            <version>0.1-sandbox-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
+		
+    </dependencies>
+
+</project>

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+public interface AddService {
+
+    double add(double n1, double n2);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Add service
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public class AddServiceImpl implements AddService {
+
+    public double add(double n1, double n2) {
+        return n1 + n2;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/AddServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+    double add(double n1, double n2);
+
+    double subtract(double n1, double n2);
+
+    double multiply(double n1, double n2);
+
+    double divide(double n1, double n2);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Scope("COMPOSITE")
+public class CalculatorServiceImpl implements CalculatorService {
+
+    private AddService addService;
+    private SubtractService subtractService;
+    private MultiplyService multiplyService;
+    private DivideService divideService;
+
+    @Reference
+    public void setAddService(AddService addService) {
+        this.addService = addService;
+    }
+
+    @Reference
+    public void setSubtractService(SubtractService subtractService) {
+        this.subtractService = subtractService;
+    }
+
+    @Reference
+    public void setDivideService(DivideService divideService) {
+        this.divideService = divideService;
+    }
+
+    @Reference
+    public void setMultiplyService(MultiplyService multiplyService) {
+        this.multiplyService = multiplyService;
+    }
+
+    public double add(double n1, double n2) {
+        return addService.add(n1, n2);
+    }
+
+    public double subtract(double n1, double n2) {
+        return subtractService.subtract(n1, n2);
+    }
+
+    public double multiply(double n1, double n2) {
+        return multiplyService.multiply(n1, n2);
+    }
+
+    public double divide(double n1, double n2) {
+        return divideService.divide(n1, n2);
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/CalculatorServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+public interface DivideService {
+
+    double divide(double n1, double n2);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Divide service.
+ */
+@Scope("COMPOSITE")
+public class DivideServiceImpl implements DivideService {
+
+    public double divide(double n1, double n2) {
+        return n1 / n2;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/DivideServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+public interface MultiplyService {
+
+    double multiply(double n1, double n2);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Multiply service.
+ */
+@Scope("COMPOSITE")
+public class MultiplyServiceImpl implements MultiplyService {
+
+    public double multiply(double n1, double n2) {
+        return n1 * n2;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/MultiplyServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+public interface SubtractService {
+
+    double subtract(double n1, double n2);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.    
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the subtract service.
+ */
+@Scope("COMPOSITE")
+public class SubtractServiceImpl implements SubtractService {
+
+    public double subtract(double n1, double n2) {
+        return n1 - n2;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/calculator/SubtractServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.    
+ */
+package test.application.context;
+
+import calculator.CalculatorService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the Calculator service and invoke it.
+ */
+public class CalculatorClient {
+    public static void main(String[] args) throws Exception {
+
+    	TestRuntimeContext context = new TestRuntimeContext("Calculator.composite");
+
+        CalculatorService calculatorService =
+                context.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+        // Calculate
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+    }
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,51 @@
+/*
+ * 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.    
+ */
+package test.application.context;
+
+import junit.framework.TestCase;
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+	private TestRuntimeContext context;
+    private CalculatorService calculatorService;
+
+    protected void setUp() throws Exception {
+    	context = new TestRuntimeContext("Calculator.composite");
+
+        calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+    }
+    
+    protected void tearDown() throws Exception {
+    	context = null;
+    	calculatorService = null;
+    }
+
+    public void testCalculator() throws Exception {
+        // Calculate
+        assertEquals(calculatorService.add(3, 2), 5.0);
+        assertEquals(calculatorService.subtract(3, 2), 1.0);
+        assertEquals(calculatorService.multiply(3, 2), 6.0);
+        assertEquals(calculatorService.divide(3, 2), 1.5);
+
+    }
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/CalculatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,103 @@
+/*
+ * 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.    
+ */
+package test.application.context;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.Composite;
+import org.apache.tuscany.assembly.model.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.assembly.util.CompositeUtil;
+import org.apache.tuscany.bean.context.CompositeApplicationContext;
+import org.apache.tuscany.java.model.JavaFactory;
+import org.apache.tuscany.java.model.impl.DefaultJavaFactory;
+import org.apache.tuscany.java.scdl.JavaConstants;
+import org.apache.tuscany.java.scdl.JavaHandler;
+import org.apache.tuscany.scdl.Constants;
+import org.apache.tuscany.scdl.impl.CompositeHandler;
+import org.apache.tuscany.scdl.impl.ImplementationHandlerRegistry;
+import org.apache.tuscany.scdl.impl.InterfaceHandlerRegistry;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * A mini test runtime that uses a custom Spring ApplicationContext to turn
+ * an SCA composite into an assembly of Spring bean definitions.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class TestRuntimeContext {
+	
+	private CompositeApplicationContext applicationContext;
+	
+	public TestRuntimeContext(String compositeFile) {
+		
+		// Create model factories
+        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+        JavaFactory javaFactory = new DefaultJavaFactory(assemblyFactory);
+
+        // Populate interface and impl handlers
+        JavaHandler javaHandler = new JavaHandler(javaFactory);
+        InterfaceHandlerRegistry interfaceHandlers = new InterfaceHandlerRegistry();
+        interfaceHandlers.addHandler(Constants.SCA10_NS, JavaConstants.INTERFACE_JAVA, javaHandler);
+        ImplementationHandlerRegistry implementationHandlers = new ImplementationHandlerRegistry();
+        implementationHandlers.addHandler(Constants.SCA10_NS, JavaConstants.IMPLEMENTATION_JAVA, javaHandler);
+
+        // Create a composite handler 
+        CompositeHandler handler = new CompositeHandler(assemblyFactory, interfaceHandlers, implementationHandlers, null);
+
+        // Parse the composite file
+		try {
+			XMLReader reader = XMLReaderFactory.createXMLReader();
+	        reader.setFeature("http://xml.org/sax/features/namespaces", true);
+	        reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+	        reader.setContentHandler(handler);
+			InputStream is = getClass().getClassLoader().getResourceAsStream(compositeFile);
+			reader.parse(new InputSource(is));
+		} catch (SAXException e) {
+			throw new TestRuntimeException(e);
+		} catch (IOException e) {
+			throw new TestRuntimeException(e);
+		}
+		Composite composite = handler.getComposite();
+		
+		// Configure the composite
+		new CompositeUtil(assemblyFactory, composite).configure(null);
+		
+		// Create a Spring application composite context for the composite
+		applicationContext = new CompositeApplicationContext(composite);
+		applicationContext.refresh();
+	}
+
+	/**
+	 * Returns the service with the specified name.
+	 * @param <B>
+	 * @param businessInterface
+	 * @param serviceName
+	 * @return
+	 */
+	public <B> B getService(Class<B> businessInterface, String serviceName) {
+		Object bean = applicationContext.getBean(serviceName);
+		return businessInterface.cast(bean);
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.    
+ */
+package test.application.context;
+
+/**
+ * TestRuntimeException
+ *
+ *  @version $Rev$ $Date$
+ */
+public class TestRuntimeException extends RuntimeException {
+	private static final long serialVersionUID = 1L;
+	
+	public TestRuntimeException(Exception e) {
+		super(e);
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/application/context/TestRuntimeException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java?view=auto&rev=522186
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java Sun Mar 25 02:29:19 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.    
+ */
+package test.model.variant;
+
+import calculator.CalculatorService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the Calculator service and invoke it.
+ */
+public class CalculatorClient {
+    public static void main(String[] args) throws Exception {
+
+    	VariantRuntimeContext context = new VariantRuntimeContext("Calculator.composite");
+
+        CalculatorService calculatorService =
+                context.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+        // Calculate
+        System.out.println("3 + 2=" + calculatorService.add(3, 2));
+        System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+        System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+        System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+    }
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules/bean-test/src/test/java/test/model/variant/CalculatorClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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