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/23 17:20:54 UTC

svn commit: r521792 [3/8] - in /incubator/tuscany/sandbox/sebastien/java/sca: modules/ modules2/ modules2/assembly/ modules2/assembly/src/ modules2/assembly/src/main/ modules2/assembly/src/main/java/ modules2/assembly/src/main/java/org/ modules2/assemb...

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

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

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ReferenceImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.Binding;
+import org.apache.tuscany.assembly.model.Callback;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.policy.model.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class ReferenceImpl extends AbstractReferenceImpl implements Reference {
+	private List<Binding> bindings = new ArrayList<Binding>();
+	private boolean wiredByImpl;
+	private List<PolicySet> policySets = new ArrayList<PolicySet>();
+	private List<ComponentService> targets = new ArrayList<ComponentService>();
+	private Callback callback;
+
+	public List<Binding> getBindings() {
+		return bindings;
+	}
+
+	public boolean isWiredByImpl() {
+		return wiredByImpl;
+	}
+
+	public void setWiredByImpl(boolean wiredByImpl) {
+		this.wiredByImpl = wiredByImpl;
+	}
+
+	public List<PolicySet> getPolicySets() {
+		return policySets;
+	}
+	
+	public List<ComponentService> getTargets() {
+		return targets;
+	}
+
+	public Callback getCallback() {
+		return callback;
+	}
+	
+	public void setCallback(Callback callback) {
+		this.callback = callback;
+	}
+}

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

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

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/ServiceImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.Binding;
+import org.apache.tuscany.assembly.model.Callback;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.policy.model.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class ServiceImpl extends AbstractServiceImpl implements Service {
+	private List<Binding> bindings = new ArrayList<Binding>();
+	private List<PolicySet> policySets = new ArrayList<PolicySet>();
+	private Callback callback;
+
+	public List<Binding> getBindings() {
+		return bindings;
+	}
+
+	public List<PolicySet> getPolicySets() {
+		return policySets;
+	}
+	
+	public Callback getCallback() {
+		return callback;
+	}
+	
+	public void setCallback(Callback callback) {
+		this.callback = callback;
+	}
+
+}

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

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

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/WireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/WireImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/WireImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/model/impl/WireImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.ComponentReference;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.Wire;
+
+/**
+ * Represents a wire
+ *
+ *  @version $Rev$ $Date$
+ */
+public class WireImpl extends BaseImpl implements Wire {
+	private ComponentReference source;
+	private ComponentService target;
+
+	public ComponentReference getSource() {
+		return source;
+	}
+
+	public ComponentService getTarget() {
+		return target;
+	}
+
+	public void setSource(ComponentReference source) {
+		this.source = source;
+	}
+
+	public void setTarget(ComponentService target) {
+		this.target = target;
+	}
+
+}

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

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

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,230 @@
+/*
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.Base;
+import org.apache.tuscany.assembly.model.Component;
+import org.apache.tuscany.assembly.model.ComponentReference;
+import org.apache.tuscany.assembly.model.ComponentService;
+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.Implementation;
+import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.assembly.model.Wire;
+
+/**
+ * A temporary utility class that resolves wires in a composite.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class CompositeUtil {
+
+	private AssemblyFactory assemblyFactory;
+	private Composite composite;
+	
+	public CompositeUtil(AssemblyFactory assemblyFactory, Composite composite) {
+		this.assemblyFactory = assemblyFactory;
+		this.composite = composite;
+	}
+	
+	public void configure(List<Base> problems) {
+		if (problems == null) {
+			problems = new ArrayList<Base>();
+		}
+		init(problems);
+		wire(problems);
+	}
+	
+	private void init(List<Base> problems) {
+		
+		// Init all component services and references
+		for (Component component: composite.getComponents()) {
+			Map<String, Service> services = new HashMap<String, Service>();
+			Map<String, Reference> references = new HashMap<String, Reference>();
+			
+			// Index services and references
+			Implementation implementation = component.getImplementation();
+			if (implementation != null) {
+				for (Service service: implementation.getServices()) {
+					services.put(service.getName(), service);
+				}
+				for (Reference reference: implementation.getReferences()) {
+					references.put(reference.getName(), reference);
+				}
+			}
+			
+			// Index component services and references
+			Map<String, ComponentService> cservices = new HashMap<String, ComponentService>();
+			Map<String, ComponentReference> creferences = new HashMap<String, ComponentReference>();
+			for (ComponentService componentService: component.getServices()) {
+				cservices.put(componentService.getName(), componentService);
+			}
+			for (ComponentReference componentReference: component.getReferences()) {
+				creferences.put(componentReference.getName(), componentReference);
+			}
+			
+			// Reconcile component services/references and implementation services/references
+			for (ComponentService componentService: cservices.values()) {
+				Service service = services.get(componentService.getName());
+				if (service != null) {
+					componentService.setService(service);
+				} else {
+					problems.add(componentService);
+				}
+			}
+			for (ComponentReference componentReference: creferences.values()) {
+				Reference reference = references.get(componentReference.getName());
+				if (reference != null) {
+					componentReference.setReference(reference);
+				} else {
+					problems.add(componentReference);
+				}
+			}
+			
+			// Create component services/references for the services/references declared by
+			// the implementation
+			for (Service service: services.values()) {
+				if (!cservices.containsKey(service.getName())) {
+					ComponentService componentService = assemblyFactory.createComponentService();
+					componentService.setName(service.getName());
+					componentService.setService(service);
+					component.getServices().add(componentService);
+				}
+			}
+			for (Reference reference: references.values()) {
+				if (!cservices.containsKey(reference.getName())) {
+					ComponentReference componentReference = assemblyFactory.createComponentReference();
+					componentReference.setName(reference.getName());
+					componentReference.setReference(reference);
+					component.getReferences().add(componentReference);
+				}
+			}
+		}
+	}
+	
+	private void wire(List<Base> problems) {
+		
+		// Index 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);
+				}
+				i++;
+				componentServices.put(component.getName() + '/' + componentService.getName(), componentService);
+			}
+			for (ComponentReference componentReference: component.getReferences()) {
+				componentReferences.put(component.getName() + '/' + componentReference.getName(), componentReference);
+			}
+		}
+		
+		// Resolve promoted services and references
+		for (Service service: composite.getServices()) {
+			CompositeService compositeService = (CompositeService)service;
+			ComponentService componentService = compositeService.getPromotedService();
+			if (componentService != null && componentService.isUnresolved()) {
+				ComponentService resolved = componentServices.get(componentService.getName());
+				if (resolved != null) {
+					compositeService.setPromotedService(resolved);
+				} else {
+					problems.add(compositeService);
+				}
+			}
+		}
+		for (Reference reference: composite.getReferences()) {
+			CompositeReference compositeReference = (CompositeReference)reference;
+			List<ComponentReference> promotedReferences = compositeReference.getPromotedReferences();
+			for (int i =0, n = promotedReferences.size(); i <  n; i++) {
+				ComponentReference componentReference = promotedReferences.get(i);
+				if (componentReference.isUnresolved()) {
+					ComponentReference resolved = componentReferences.get(componentReference.getName());
+					if (resolved != null) {
+						promotedReferences.set(i, resolved);
+					} else {
+						problems.add(compositeReference);
+					}
+				}
+			}
+		}
+		
+		// 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);
+					}
+				}
+			}
+		}
+
+		// Wire references as specified in wires
+		List<Wire> wires = composite.getWires();
+		for (int i = 0, n = wires.size(); i < n; i++) {
+			Wire wire = wires.get(i);
+			
+			ComponentReference resolvedReference;
+			ComponentService resolvedService;
+			
+			ComponentReference source = wire.getSource();
+			if (source != null && source.isUnresolved()) {
+				resolvedReference = componentReferences.get(source.getName());
+				if (resolvedReference != null) {
+					wire.setSource(resolvedReference);
+				} else {
+					problems.add(source);
+				}
+			} else {
+				resolvedReference = wire.getSource();
+			}
+
+			ComponentService target = wire.getTarget();
+			if (target != null && target.isUnresolved()) {
+				resolvedService = componentServices.get(target.getName());
+				if (resolvedService != null) {
+					wire.setTarget(target);
+				} else {
+					problems.add(source);
+				}
+			} else {
+				resolvedService = wire.getTarget();
+			}
+			if (resolvedReference != null && resolvedService != null) {
+				resolvedReference.getTargets().add(resolvedService);
+			}
+		}
+	}
+	
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java Fri Mar 23 09:20:35 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.util;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A simple print utility class to help print the assembly model.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class PrintUtil {
+	
+	PrintWriter out;
+	Set<Object> objs = new HashSet<Object>();
+	int level;
+	
+	public PrintUtil(OutputStream out) {
+		this.out = new PrintWriter(new OutputStreamWriter(out), true);
+	}
+	
+	void indent(int level) {
+		for (int i=0; i<level; i++) {
+			out.print("  ");
+		}
+	}
+	
+	public void print(Object obj) {
+		if (objs.contains(obj)) {
+			indent(level);
+			out.println(obj.getClass().getName()+"@"+System.identityHashCode(obj));
+		}
+		else {
+			objs.add(obj);
+			try {
+				indent(level);
+				out.println(obj.getClass().getSimpleName() + " {");
+				BeanInfo bi = Introspector.getBeanInfo(obj.getClass());
+				for (PropertyDescriptor pd: bi.getPropertyDescriptors()) {
+					try {
+						Object pv = pd.getReadMethod().invoke(obj);
+						if (pv != null) {
+							if (pv.getClass().isArray()) {
+								pv = Arrays.asList((Object[])pv);
+							}
+							if (pv instanceof List) {
+								if (!((List)pv).isEmpty()) {
+									level++;
+									indent(level);
+									out.println(pd.getName() + "= [");
+									for (Object e: (List)pv) {
+										level++;
+										print(e);
+										level--;
+									}
+									indent(level);
+									out.println( " ]");
+									level--;
+								}
+							}
+							else {
+								Class<?> pvc = pv.getClass();
+								if (pvc.isPrimitive() || pvc.getName().startsWith("java.") || pvc.getName().startsWith("javax.") || pvc.isEnum()) {
+									if (!pd.getName().equals("class")) {
+										if (!(Boolean.FALSE.equals(pv))) {
+											indent(level+1);
+											out.println(pd.getName() + "=" + pv.toString());
+										}
+									}
+								} else {
+									level++;
+									indent(level);
+									out.println(pd.getName() + "= {" );
+									level++;
+									print(pv);
+									level--;
+									indent(level);
+									out.println("}");
+									level--;
+								}
+							}
+						}
+					} catch (Exception e) {}
+				}
+				indent(level);
+				out.println("}");
+			} catch (IntrospectionException e) {
+				indent(level);
+				out.println(e);
+			}
+		}
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/main/java/org/apache/tuscany/assembly/util/PrintUtil.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,205 @@
+/*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.model.impl.AssemblyFactoryImpl;
+
+/**
+ * Test building of assembly model instances using the assembly factory.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class AssemblyFactoryTestCase extends TestCase {
+	
+	AssemblyFactory factory;
+
+	public void setUp() throws Exception {
+		factory = new AssemblyFactoryImpl();
+	}
+
+	public void tearDown() throws Exception {
+		factory = null;
+	}
+
+	public void testCreateComponent() {
+		createComponent("AccountServiceComponent1");
+	}
+
+	public void testCreateComponentType() {
+		createComponentType();
+	}
+
+	public void testCreateComposite() {
+		createComposite();
+	}
+
+	public void testCreateConstrainingType() {
+		createConstrainingType();
+	}
+
+	/**
+	 * Create a composite
+	 */
+	Composite createComposite() {
+		Composite c = factory.createComposite();
+		
+		Component c1 = createComponent("AccountServiceComponent1");
+		c.getComponents().add(c1);
+		Component c2 = createComponent("AccountServiceComponent2");
+		c.getComponents().add(c2);
+		
+		Wire w = factory.createWire();
+		w.setSource(c1.getReferences().get(0));
+		w.setTarget(c2.getServices().get(0));
+		c.getWires().add(w);
+		
+		CompositeService cs = factory.createCompositeService();
+		cs.setName("AccountService");
+		cs.setPromotedService(c1.getServices().get(0));
+		c.getServices().add(cs);
+		
+		CompositeReference cr = factory.createCompositeReference();
+		cr.setName("StockQuoteService");
+		cr.getPromotedReferences().add(c2.getReferences().get(1));
+		c.getReferences().add(cr);
+		
+		return c;
+	}
+	
+	/**
+	 * Create a new component
+	 */
+	Component createComponent(String name) {
+		Component c = factory.createComponent();
+		
+		c.setName(name);
+		
+		ConstrainingType constraint =factory.createConstrainingType();
+		c.setConstrainingType(constraint);
+		
+		Implementation i = new TestImplementation(factory);
+		c.setImplementation(i);
+		
+		ComponentProperty p = factory.createComponentProperty();
+		p.setName("currency");
+		p.setDefaultValue("USD");
+		p.setMustSupply(true);
+		p.setXSDType(new QName("", ""));
+		p.setProperty(i.getProperties().get(0));
+		c.getProperties().add(p);
+		
+		{
+			ComponentReference r = factory.createComponentReference();
+			r.setName("accountDataService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			r.setReference(i.getReferences().get(0));
+			c.getReferences().add(r);
+		}
+
+		{
+			ComponentReference r = factory.createComponentReference();
+			r.setName("stockQuoteService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			r.setReference(i.getReferences().get(1));
+			c.getReferences().add(r);
+		}
+		
+		ComponentService s = factory.createComponentService();
+		s.setName("AccountService");
+		s.setService(i.getServices().get(0));
+		c.getServices().add(s);
+		
+		return c;
+	}
+	
+	/**
+	 * Create a new component type
+	 * @return
+	 */
+	ComponentType createComponentType() {
+		ComponentType ctype = factory.createComponentType();
+		
+		Property p = factory.createProperty();
+		p.setName("currency");
+		p.setDefaultValue("USD");
+		p.setMustSupply(true);
+		p.setXSDType(new QName("", ""));
+		ctype.getProperties().add(p);
+		
+		{
+			Reference r = factory.createReference();
+			r.setName("accountDataService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			ctype.getReferences().add(r);
+		}
+
+		{
+			Reference r = factory.createReference();
+			r.setName("stockQuoteService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			ctype.getReferences().add(r);
+		}
+		
+		Service s = factory.createService();
+		s.setName("AccountService");
+		ctype.getServices().add(s);
+		
+		return ctype;
+	}
+
+	/**
+	 * Create a new constraining type
+	 * @return
+	 */
+	ConstrainingType createConstrainingType() {
+		ConstrainingType ctype = factory.createConstrainingType();
+		
+		AbstractProperty p = factory.createAbstractProperty();
+		p.setName("currency");
+		p.setDefaultValue("USD");
+		p.setMustSupply(true);
+		p.setXSDType(new QName("", ""));
+		ctype.getProperties().add(p);
+		
+		{
+			AbstractReference r = factory.createAbstractReference();
+			r.setName("accountDataService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			ctype.getReferences().add(r);
+		}
+
+		{
+			AbstractReference r = factory.createAbstractReference();
+			r.setName("stockQuoteService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			ctype.getReferences().add(r);
+		}
+		
+		AbstractService s = factory.createAbstractService();
+		s.setName("AccountService");
+		ctype.getServices().add(s);
+		
+		return ctype;
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/AssemblyFactoryTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/TestImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/TestImplementation.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/TestImplementation.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/TestImplementation.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.model.impl.ComponentTypeImpl;
+
+/**
+ * A test component implementation model.
+ *
+ *  @version $Rev$ $Date$
+ */
+public class TestImplementation extends ComponentTypeImpl implements Implementation {
+
+	public TestImplementation(AssemblyFactory factory) {
+		
+		Property p = factory.createProperty();
+		p.setName("currency");
+		p.setDefaultValue("USD");
+		p.setMustSupply(true);
+		p.setXSDType(new QName("", ""));
+		getProperties().add(p);
+		
+		{
+			Reference r = factory.createReference();
+			r.setName("accountDataService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			getReferences().add(r);
+		}
+
+		{
+			Reference r = factory.createReference();
+			r.setName("stockQuoteService");
+			r.setMultiplicity(Multiplicity.ONE_ONE);
+			getReferences().add(r);
+		}
+		
+		Service s = factory.createService();
+		s.setName("AccountService");
+		getServices().add(s);
+		
+	}
+	
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/TestImplementation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/java/org/apache/tuscany/assembly/model/TestImplementation.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/Calculator.composite?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/Calculator.composite (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/Calculator.composite Fri Mar 23 09:20:35 2007
@@ -0,0 +1,52 @@
+<?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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	xmlns:calc="http://sample.calculator"
+	name="calc:Calculator">
+
+    <service name="CalculatorService" promote="CalculatorServiceComponent">
+        <interface.java interface="calculator.CalculatorService"/>
+    </service>
+
+    <component name="CalculatorServiceComponent">
+		<implementation.java class="calculator.CalculatorServiceImpl"/>
+        <reference name="addService" target="AddServiceComponent"/>
+        <reference name="subtractService" target="SubtractServiceComponent"/>
+        <reference name="multiplyService" target="MultiplyServiceComponent"/>
+        <reference name="divideService" target="DivideServiceComponent"/>
+    </component>
+
+    <component name="AddServiceComponent">
+        <implementation.java class="calculator.AddServiceImpl"/>
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl"/>
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl"/>
+    </component>
+
+</composite>

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/Calculator.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/Calculator.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorComponent.constrainingType?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorComponent.constrainingType (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorComponent.constrainingType Fri Mar 23 09:20:35 2007
@@ -0,0 +1,33 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	xmlns:calc="http://sample.calculator"
+	name="calc:CalculatorComponent">
+
+  <service name="CalculatorService">
+        <interface.java class="calculator.CalculatorService" />
+  </service>
+
+  <reference name="divideService">
+        <interface.java class="calculator.DivideService" />
+  </reference>  
+
+</constrainingType>              
+       
\ No newline at end of file

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorImpl.componentType?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorImpl.componentType (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorImpl.componentType Fri Mar 23 09:20:35 2007
@@ -0,0 +1,31 @@
+<?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">
+
+  <service name="CalculatorService">
+        <interface.java class="calculator.CalculatorService" />
+  </service>
+
+  <reference name="divideService">
+        <interface.java class="calculator.DivideService" />
+  </reference>  
+
+</componentType>              
+       
\ No newline at end of file

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorImpl.componentType
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/assembly/src/test/resources/CalculatorImpl.componentType
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/pom.xml?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/pom.xml (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/pom.xml Fri Mar 23 09:20:35 2007
@@ -0,0 +1,49 @@
+<?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-builder</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Tuscany SCA Assembly Model Builder</name>
+    <description>Apache Tuscany SCA Assembly Model Builder</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca.modules</groupId>
+            <artifactId>tuscany-assembly</artifactId>
+            <version>0.1-sandbox-incubating-SNAPSHOT</version>
+        </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/modules2/builder/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/AssemblyBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/AssemblyBuilder.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/AssemblyBuilder.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/AssemblyBuilder.java Fri Mar 23 09:20:35 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 org.apache.tuscany.assembly.builder;
+
+import org.apache.tuscany.assembly.builder.ComponentBuilder;
+import org.apache.tuscany.assembly.builder.ComponentPropertyBuilder;
+import org.apache.tuscany.assembly.builder.ComponentReferenceBuilder;
+import org.apache.tuscany.assembly.builder.ComponentServiceBuilder;
+import org.apache.tuscany.assembly.builder.CompositeBuilder;
+
+public interface AssemblyBuilder {
+	
+	CompositeBuilder composite(String name);
+	
+	ComponentBuilder component(String name);
+	
+	ComponentReferenceBuilder reference(String name);
+
+	ComponentServiceBuilder service(String name);
+	
+	ComponentPropertyBuilder property(String name);
+	
+	CompositeBuilder domain(String uri);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/AssemblyBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/AssemblyBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentBuilder.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentBuilder.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentBuilder.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.builder;
+
+public interface ComponentBuilder {
+
+	ComponentBuilder implementedBy(Class clazz);
+	
+	ComponentBuilder implementedBy(CompositeBuilder composite);
+	
+	public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences);
+
+	public ComponentBuilder provides(ComponentServiceBuilder... componentServices);
+	
+	public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentPropertyBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentPropertyBuilder.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentPropertyBuilder.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentPropertyBuilder.java Fri Mar 23 09:20:35 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.builder;
+
+public interface ComponentPropertyBuilder {
+	
+	ComponentPropertyBuilder ofType(String type);
+	
+	ComponentPropertyBuilder configuredTo(Object value);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentPropertyBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentPropertyBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentReferenceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentReferenceBuilder.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentReferenceBuilder.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentReferenceBuilder.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.builder;
+
+public interface ComponentReferenceBuilder {
+	
+	ComponentReferenceBuilder wiredTo(String target);
+	
+	ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target);
+	
+	ComponentReferenceBuilder typedBy(Class interfaceClass);
+	
+	ComponentReferenceBuilder promotedAs(String promoted);
+
+	ComponentReferenceBuilder promoted();
+	
+	ComponentReferenceBuilder boundTo(String uri);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentReferenceBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentReferenceBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentServiceBuilder.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentServiceBuilder.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentServiceBuilder.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.builder;
+
+public interface ComponentServiceBuilder {
+	
+	ComponentServiceBuilder typedBy(Class interfaceClass);
+	
+	ComponentServiceBuilder promotedAs(String promoted);
+	
+	ComponentServiceBuilder promoted();
+	
+	ComponentServiceBuilder boundTo(String uri);
+	
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentServiceBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/ComponentServiceBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/CompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/CompositeBuilder.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/CompositeBuilder.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/CompositeBuilder.java Fri Mar 23 09:20:35 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.builder;
+
+public interface CompositeBuilder {
+	
+	CompositeBuilder contains(ComponentBuilder... components);
+	
+	CompositeBuilder includes(CompositeBuilder... includes);
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/CompositeBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/CompositeBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.builder.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.builder.AssemblyBuilder;
+import org.apache.tuscany.assembly.builder.ComponentBuilder;
+import org.apache.tuscany.assembly.builder.ComponentPropertyBuilder;
+import org.apache.tuscany.assembly.builder.ComponentReferenceBuilder;
+import org.apache.tuscany.assembly.builder.ComponentServiceBuilder;
+import org.apache.tuscany.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.assembly.model.impl.AssemblyFactoryImpl;
+
+public class AssemblyBuilderImpl extends AssemblyFactoryImpl implements AssemblyBuilder {
+
+	public ComponentBuilder component(String name) {
+		ComponentBuilderImpl component = new ComponentBuilderImpl();
+		component.setName(name);
+		return component;
+	}
+
+	public CompositeBuilder composite(String name) {
+		CompositeBuilderImpl composite = new CompositeBuilderImpl();
+		//TODO handle namespace
+		composite.setName(new QName("", name));
+		return composite;
+	}
+
+	public CompositeBuilder domain(String uri) {
+		CompositeBuilderImpl composite = new CompositeBuilderImpl();
+		composite.setName(new QName(uri, ""));
+		return composite;
+	}
+
+	public ComponentPropertyBuilder property(String name) {
+		ComponentPropertyBuilderImpl property = new ComponentPropertyBuilderImpl();
+		property.setName(name);
+		return property;
+	}
+
+	public ComponentReferenceBuilder reference(String name) {
+		ComponentReferenceBuilderImpl reference = new ComponentReferenceBuilderImpl();
+		reference.setName(name);
+		return reference;
+	}
+
+	public ComponentServiceBuilder service(String name) {
+		ComponentServiceBuilderImpl service = new ComponentServiceBuilderImpl();
+		service.setName(name);
+		return service;
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/AssemblyBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentBuilderImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentBuilderImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentBuilderImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.builder.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.assembly.builder.ComponentBuilder;
+import org.apache.tuscany.assembly.builder.ComponentPropertyBuilder;
+import org.apache.tuscany.assembly.builder.ComponentReferenceBuilder;
+import org.apache.tuscany.assembly.builder.ComponentServiceBuilder;
+import org.apache.tuscany.assembly.builder.CompositeBuilder;
+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.Composite;
+import org.apache.tuscany.assembly.model.impl.ComponentImpl;
+
+public class ComponentBuilderImpl extends ComponentImpl implements ComponentBuilder {
+	
+	public ComponentBuilderImpl() {
+	}
+	
+	public ComponentBuilder implementedBy(Class clazz) {
+		//FIXME support Java implementations
+		return this;
+	}
+	
+	public ComponentBuilder implementedBy(CompositeBuilder composite) {
+		setImplementation((Composite)composite);
+		return this;
+	}
+	
+	public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences) {
+		List<ComponentReference> references = getReferences();
+		for (ComponentReferenceBuilder componentReference: componentReferences) {
+			references.add((ComponentReference)componentReference);
+		}
+		return this;
+	}
+
+	public ComponentBuilder provides(ComponentServiceBuilder... componentServices) {
+		List<ComponentService> services = getServices();
+		for (ComponentServiceBuilder componentService: componentServices) {
+			services.add((ComponentService)componentService);
+		}
+		return this;
+	}
+	
+	public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties) {
+		List<ComponentProperty> properties = getProperties();
+		for (ComponentPropertyBuilder componentProperty: componentProperties) {
+			properties.add((ComponentProperty)componentProperty);
+		}
+		return this;
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentPropertyBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentPropertyBuilderImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentPropertyBuilderImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentPropertyBuilderImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.builder.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.builder.ComponentPropertyBuilder;
+import org.apache.tuscany.assembly.model.impl.ComponentPropertyImpl;
+
+public class ComponentPropertyBuilderImpl extends ComponentPropertyImpl implements ComponentPropertyBuilder {
+	
+	public ComponentPropertyBuilderImpl ofType(String type) {
+		//TODO handle namespace
+		this.setXSDType(new QName("", type));
+		return this;
+	}
+	
+	public ComponentPropertyBuilderImpl configuredTo(Object value) {
+		//TODO set the value instead
+		this.setDefaultValue(value);
+		return this;
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentPropertyBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentPropertyBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentReferenceBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentReferenceBuilderImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentReferenceBuilderImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentReferenceBuilderImpl.java Fri Mar 23 09:20:35 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 org.apache.tuscany.assembly.builder.impl;
+
+import org.apache.tuscany.assembly.builder.ComponentReferenceBuilder;
+import org.apache.tuscany.assembly.builder.ComponentServiceBuilder;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.CompositeReference;
+import org.apache.tuscany.assembly.model.impl.ComponentReferenceImpl;
+import org.apache.tuscany.assembly.model.impl.ComponentServiceImpl;
+import org.apache.tuscany.assembly.model.impl.CompositeReferenceImpl;
+
+public class ComponentReferenceBuilderImpl extends ComponentReferenceImpl implements ComponentReferenceBuilder {
+	
+	private CompositeReference compositeReference;
+	
+	public ComponentReferenceBuilder wiredTo(String target) {
+		ComponentService componentService = new ComponentServiceImpl();
+		componentService.setUnresolved(true);
+		componentService.setName(target);
+		getTargets().add(componentService);
+		return this;
+	}
+	
+	public ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target) {
+		getTargets().add((ComponentServiceImpl)target);
+		return this;
+	}
+	
+	public ComponentReferenceBuilderImpl typedBy(Class interfaceClass) {
+		//FIXME support for Java interfaces 
+		return this;
+	}
+	
+	public ComponentReferenceBuilderImpl promotedAs(String promoted) {
+		compositeReference = new CompositeReferenceImpl();
+		compositeReference.setName(promoted);
+		return this;
+	}
+
+	public ComponentReferenceBuilderImpl promoted() {
+		compositeReference = new CompositeReferenceImpl();
+		compositeReference.setName(getName());
+		return this;
+	}
+
+	public ComponentReferenceBuilder boundTo(String uri) {
+		//TODO support bindings
+		return this;
+	}
+
+	CompositeReference getCompositeReference() {
+		return compositeReference;
+	}
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentReferenceBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentReferenceBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentServiceBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentServiceBuilderImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentServiceBuilderImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentServiceBuilderImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.builder.impl;
+
+import org.apache.tuscany.assembly.builder.ComponentServiceBuilder;
+import org.apache.tuscany.assembly.model.CompositeService;
+import org.apache.tuscany.assembly.model.impl.ComponentServiceImpl;
+import org.apache.tuscany.assembly.model.impl.CompositeServiceImpl;
+
+public class ComponentServiceBuilderImpl extends ComponentServiceImpl implements ComponentServiceBuilder {
+	
+	private CompositeService compositeService;
+	
+	public ComponentServiceBuilderImpl typedBy(Class interfaceClass) {
+		//FIXME support for Java interfaces 
+		return this;
+	}
+	
+	public ComponentServiceBuilderImpl promotedAs(String promoted) {
+		compositeService = new CompositeServiceImpl();
+		compositeService.setName(promoted);
+		return this;
+	}
+
+	public ComponentServiceBuilderImpl promoted() {
+		compositeService = new CompositeServiceImpl();
+		compositeService.setName(getName());
+		return this;
+	}
+	
+	public ComponentServiceBuilder boundTo(String uri) {
+		// TODO support bindings
+		return this;
+	}
+	
+	CompositeService getCompositeService() {
+		return compositeService;
+	}
+	
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentServiceBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/ComponentServiceBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/CompositeBuilderImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/CompositeBuilderImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/CompositeBuilderImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.builder.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.assembly.builder.ComponentBuilder;
+import org.apache.tuscany.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.assembly.model.Component;
+import org.apache.tuscany.assembly.model.ComponentReference;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.Composite;
+import org.apache.tuscany.assembly.model.impl.CompositeImpl;
+
+public class CompositeBuilderImpl extends CompositeImpl implements CompositeBuilder {
+	
+	public CompositeBuilder contains(ComponentBuilder... componentBuilders) {
+		List<Component> components = getComponents();
+		for (ComponentBuilder componentBuilder: componentBuilders) {
+			Component component = (Component)componentBuilder;
+			components.add(component);
+
+			for (ComponentService componentService: component.getServices()) {
+				ComponentServiceBuilderImpl builder = (ComponentServiceBuilderImpl)componentService;
+				if (builder.getCompositeService() != null)
+					getServices().add(builder.getCompositeService());
+			}
+			for (ComponentReference componentReference: component.getReferences()) {
+				ComponentReferenceBuilderImpl builder = (ComponentReferenceBuilderImpl)componentReference;
+				if (builder.getCompositeReference() != null)
+					getReferences().add(builder.getCompositeReference());
+			}
+		}
+		return this;
+	}
+	
+	public CompositeBuilder includes(CompositeBuilder... compositeBuilders) {
+		List<Composite> list = getIncludes();
+		for (CompositeBuilder composite: compositeBuilders) {
+			list.add((Composite)composite);
+		}
+		return this;
+	}
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/CompositeBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/main/java/org/apache/tuscany/assembly/builder/impl/CompositeBuilderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataService.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataService.java Fri Mar 23 09:20:35 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.    
+ */
+
+package org.apache.tuscany.assembly.builder;
+
+public interface AccountDataService {
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataServiceImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataServiceImpl.java Fri Mar 23 09:20:35 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.    
+ */
+
+package org.apache.tuscany.assembly.builder;
+
+public class AccountDataServiceImpl {
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountDataServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountService.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountService.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountService.java Fri Mar 23 09:20:35 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.    
+ */
+
+package org.apache.tuscany.assembly.builder;
+
+public interface AccountService {
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountServiceImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountServiceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountServiceImpl.java Fri Mar 23 09:20:35 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.    
+ */
+
+package org.apache.tuscany.assembly.builder;
+
+public class AccountServiceImpl {
+
+}

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/builder/src/test/java/org/apache/tuscany/assembly/builder/AccountServiceImpl.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