summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly')
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java78
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java151
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java43
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java28
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java167
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java45
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java114
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java53
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java142
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java89
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java113
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java59
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java90
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java137
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java44
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java57
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java62
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java118
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java41
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java179
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java185
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java45
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java66
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java36
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java50
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java29
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java33
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java40
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java80
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java62
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java35
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java59
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java85
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java31
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java54
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java107
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java149
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java51
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ContractBuilder.java37
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java479
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java50
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java31
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java84
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java39
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java112
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java46
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java36
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java138
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java45
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java124
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java77
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java186
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java97
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java119
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java71
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java176
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java200
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java63
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java62
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java95
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java88
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java321
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java289
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java49
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java62
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java89
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java59
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java156
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java40
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java169
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java126
-rw-r--r--sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java105
73 files changed, 6972 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
new file mode 100644
index 0000000000..dca1decb76
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
@@ -0,0 +1,78 @@
+/*
+ * 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.sca.assembly;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Interface contracts define one or more business functions. These business
+ * functions are provided by services and are used by references.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface AbstractContract extends Base, Extensible, PolicySubject {
+
+ /**
+ * Returns the name of the contract.
+ *
+ * @return the name of the contract
+ */
+ String getName();
+
+ /**
+ * Sets the name of the contract.
+ *
+ * @param name the name of the contract
+ */
+ void setName(String name);
+
+ /**
+ * Returns the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @return the interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Sets the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @param interfaceContract the interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+
+ /**
+ * Returns true if this contract is a reference or service created internally
+ * to handle a callback interface of another contract, false otherwise.
+ *
+ * @return true for a callback contract, false otherwise
+ */
+ boolean isForCallback();
+
+ /**
+ * Sets a flag indicating whether this is a callback contract.
+ *
+ * @param isCallback true for a callback contract, false otherwise
+ */
+ void setForCallback(boolean isCallback);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
new file mode 100644
index 0000000000..45fa05d66c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
@@ -0,0 +1,151 @@
+/*
+ * 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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * A property allows for the configuration of an implementation with externally
+ * set data values. An implementation can have zero or more properties. Each
+ * property has a data type, which may be either simple or complex. An
+ * implementation may also define a default value for a property.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractProperty extends Base, Extensible {
+
+ /**
+ * Returns the property name.
+ *
+ * @return the property name
+ */
+ String getName();
+
+ /**
+ * Sets the property name.
+ *
+ * @param name the property name
+ */
+ void setName(String name);
+
+ /**
+ * Returns the default value of the property.
+ *
+ * @return the default value of this property
+ */
+ Object getValue();
+
+ /**
+ * Sets the default value of the property.
+ *
+ * @param defaultValue the default value of this property
+ */
+ void setValue(Object defaultValue);
+
+ /**
+ * Returns true if the property allows multiple values.
+ *
+ * @return true if the property allows multiple values
+ */
+ boolean isMany();
+
+ /**
+ * Sets whether or not the property allows multiple values.
+ *
+ * @param many true if the property should allow multiple values
+ */
+ void setMany(boolean many);
+
+ /**
+ * Returns true if a value must be supplied for the property.
+ *
+ * @return true is a value must be supplied for the property
+ */
+ boolean isMustSupply();
+
+ /**
+ * Sets whether a value must be supplied for the property.
+ *
+ * @param mustSupply set to true to require that a value be supplied for
+ * uses of this property
+ */
+ void setMustSupply(boolean mustSupply);
+
+ /**
+ * Returns the data type of this property. This is the qualified name of an
+ * XML schema type.
+ *
+ * @return the type of this property
+ */
+ QName getXSDType();
+
+ /**
+ * Sets the data type of this property. This is the qualified name of an XML
+ * schema type.
+ *
+ * @param type the type of this property
+ */
+ void setXSDType(QName type);
+
+ /**
+ * Returns the element defining the data type of this property. This is the
+ * qualified name of an XML schema element.
+ *
+ * @return the element defining the type of this property
+ */
+ QName getXSDElement();
+
+ /**
+ * Sets the element defining the data type of this property. This is the
+ * qualified name of an XML schema element.
+ *
+ * @param element the element defining the type of this property
+ */
+ void setXSDElement(QName element);
+
+ /**
+ * Get the data type for this property
+ * @return The data type
+ */
+ DataType getDataType();
+
+ /**
+ * Set the data type
+ * @param dataType The data type
+ */
+ void setDataType(DataType dataType);
+
+ /**
+ * Get the XML schema that represents the type if this property.
+ * Used during property value validation
+ *
+ * @return
+ */
+ Object getXSDDefinition();
+
+ /**
+ * Set the XML schema that represents the type if this property.
+ * Used during property value validation
+ *
+ * @param xsdDefintion
+ */
+ void setXSDDefinition(Object xsdDefintion);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
new file mode 100644
index 0000000000..a9ef26bbb9
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
@@ -0,0 +1,43 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * Represents a reference contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractReference extends AbstractContract {
+
+ /**
+ * Returns the multiplicity allowed for wires connected to this reference.
+ *
+ * @return the multiplicity allowed for wires connected to this reference
+ */
+ Multiplicity getMultiplicity();
+
+ /**
+ * Sets the multiplicity allowed for wires connected to this reference.
+ *
+ * @param multiplicity the multiplicity allowed for wires connected to this
+ * reference
+ */
+ void setMultiplicity(Multiplicity multiplicity);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
new file mode 100644
index 0000000000..9ae511c07b
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
@@ -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.sca.assembly;
+
+/**
+ * Represents a service contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractService extends AbstractContract {
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
new file mode 100644
index 0000000000..5d82b9b727
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
@@ -0,0 +1,167 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * A factory for the assembly model
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface AssemblyFactory {
+
+ /**
+ * Create a new abstract property.
+ *
+ * @return a new abstract property
+ */
+ AbstractProperty createAbstractProperty();
+
+ /**
+ * Create a new abstract reference.
+ *
+ * @return a new abstract reference
+ */
+ AbstractReference createAbstractReference();
+
+ /**
+ * Create a new abstract service.
+ *
+ * @return a new abstract service
+ */
+ AbstractService createAbstractService();
+
+ /**
+ * Create a new callback.
+ *
+ * @return
+ */
+ Callback createCallback();
+
+ /**
+ * Create a new component.
+ *
+ * @return a new component
+ */
+ Component createComponent();
+
+ /**
+ * Create a new component property.
+ *
+ * @return a new component property
+ */
+ ComponentProperty createComponentProperty();
+
+ /**
+ * Create a new component reference.
+ *
+ * @return a new component reference
+ */
+ ComponentReference createComponentReference();
+
+ /**
+ * Create a new component service.
+ *
+ * @return a new component service
+ */
+ ComponentService createComponentService();
+
+ /**
+ * Create a new component type
+ *
+ * @return a new component type
+ */
+ ComponentType createComponentType();
+
+ /**
+ * Create a new composite.
+ *
+ * @return a new composite
+ */
+ Composite createComposite();
+
+ /**
+ * Create a new composite reference.
+ *
+ * @return a new composite reference
+ */
+ CompositeReference createCompositeReference();
+
+ /**
+ * Create a new composite service.
+ *
+ * @return a new composite service
+ */
+ CompositeService createCompositeService();
+
+ /**
+ * Create a new property.
+ *
+ * @return a new property
+ */
+ Property createProperty();
+
+ /**
+ * Create a new reference.
+ *
+ * @return a new reference
+ */
+ Reference createReference();
+
+ /**
+ * Create a new service.
+ *
+ * @return a new service
+ */
+ Service createService();
+
+ /**
+ * Create a new wire.
+ *
+ * @return a new wire
+ */
+ Wire createWire();
+
+ /**
+ * Create an Extension
+ * @return
+ */
+ Extension createExtension();
+
+ /**
+ * Create a new endpoint
+ *
+ * @return a new endpoint
+ */
+ Endpoint createEndpoint();
+
+ /**
+ * Create a new endpoint reference
+ *
+ * @return a new endpoint reference
+ */
+ EndpointReference createEndpointReference();
+
+ /**
+ * Create a new configured operation.
+ *
+ * @return a new ConfiguredOperation
+ */
+ ConfiguredOperation createConfiguredOperation();
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
new file mode 100644
index 0000000000..b9abb90b03
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
@@ -0,0 +1,45 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * Base interface for all assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface Base {
+ String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912";
+ String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1";
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
new file mode 100644
index 0000000000..9b96556173
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
@@ -0,0 +1,114 @@
+/*
+ * 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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a binding.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface Binding extends Base, Cloneable {
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding URI
+ */
+ String getURI();
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding URI
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ String getName();
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ void setName(String name);
+
+ /**
+ * Clone the binding
+ *
+ * @return the clone
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Returns the QName type for the binding
+ *
+ * @return the binding type QName
+ */
+ QName getType();
+
+ /**
+ * Returns the request wire format
+ *
+ * @return the request wire format or null is none is specified
+ */
+ WireFormat getRequestWireFormat();
+
+ /**
+ * Sets the request wire format
+ *
+ * @param wireFormat the request wire format
+ */
+ void setRequestWireFormat(WireFormat wireFormat);
+
+ /**
+ * Returns the response wire format
+ *
+ * @return the response wire format or null is none is specified
+ */
+ WireFormat getResponseWireFormat();
+
+ /**
+ * Sets the response wire format
+ *
+ * @param wireFormat the response wire format
+ */
+ void setResponseWireFormat(WireFormat wireFormat);
+
+ /**
+ * Returns the operation selector
+ *
+ * @return the operation selector or null is none is specified
+ */
+ OperationSelector getOperationSelector();
+
+ /**
+ * Sets the operation selector
+ *
+ * @param operationSelector the operation selector
+ */
+ void setOperationSelector(OperationSelector operationSelector);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
new file mode 100644
index 0000000000..a220f14159
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
@@ -0,0 +1,53 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents a callback object describing the bindings to use for callbacks.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Callback extends Base, Extensible, PolicySubject {
+
+ /**
+ * Returns the bindings supported for callbacks.
+ *
+ * @return the bindings supported for callbacks
+ */
+ List<Binding> getBindings();
+
+ /**
+ * Returns the contract that holds this callback
+ *
+ * @return the contract that holds this callback
+ */
+ Contract getParentContract();
+
+ /**
+ * Sets the contract that holds this callback
+ *
+ * @param contract the contract that holds this callback
+ */
+ void setParentContract(Contract contract);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
new file mode 100644
index 0000000000..efd8557e07
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
@@ -0,0 +1,142 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents a component. A component is a configured instance of an
+ * implementation.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Component extends Base, Extensible, PolicySubject, Cloneable {
+
+ /**
+ * Returns the URI of the component.
+ *
+ * @return the URI of the component
+ */
+ String getURI();
+
+ /**
+ * Sets the URI of the component.
+ *
+ * @param uri the URI of the component
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the name of the component.
+ *
+ * @return the name of the component
+ */
+ String getName();
+
+ /**
+ * Sets the name of the component.
+ *
+ * @param name the name of the component
+ */
+ void setName(String name);
+
+ /**
+ * Returns the component implementation.
+ *
+ * @return the component implementation
+ */
+ Implementation getImplementation();
+
+ /**
+ * Sets the component implementation
+ *
+ * @param implementation the component implementation
+ */
+ void setImplementation(Implementation implementation);
+
+ /**
+ * Returns a list of references used by the component.
+ *
+ * @return a list of references used by the component
+ */
+ List<ComponentReference> getReferences();
+
+ /**
+ * Return a reference by name
+ *
+ * @param name the reference name
+ * @return reference the reference
+ */
+ ComponentReference getReference(String name);
+
+ /**
+ * Returns a list of services exposed by the component.
+ *
+ * @return a list of services exposed by the component
+ */
+ List<ComponentService> getServices();
+
+ /**
+ * Return a service by name
+ *
+ * @param name the service name
+ * @return service the service
+ */
+ ComponentService getService(String name);
+
+ /**
+ * Returns a list of properties for the component.
+ *
+ * @return a list of properties
+ */
+ List<ComponentProperty> getProperties();
+
+ /**
+ * Return a property by name
+ *
+ * @param name the property name
+ * @return property the property
+ */
+ ComponentProperty getProperty(String name);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+ /**
+ * Returns a clone of the component.
+ *
+ * @return a clone of the component
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
new file mode 100644
index 0000000000..1202b4d83a
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
@@ -0,0 +1,89 @@
+/*
+ * 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.sca.assembly;
+
+import javax.xml.xpath.XPathExpression;
+
+/**
+ * Represents a configured property of a component.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface ComponentProperty extends Property {
+
+ /**
+ * Returns the property defined by the component implementation.
+ *
+ * @return the property defined by the component implementation
+ */
+ Property getProperty();
+
+ /**
+ * Sets the property defined by this component implementation.
+ *
+ * @param property the property defined by this component implementation
+ */
+ void setProperty(Property property);
+
+ /**
+ * Returns an XPath expression referencing a property of the enclosing
+ * composite.
+ *
+ * @return an XPath expression referencing a property of the enclosing
+ * composite
+ */
+ String getSource();
+
+ /**
+ * Sets an XPath expression referencing a property of the enclosing
+ * composite.
+ *
+ * @param source an XPath expression referencing a property of the enclosing
+ * composite
+ */
+ void setSource(String source);
+
+ /**
+ * Get the XPath expression for the source attribute
+ * @return the XPath expression for the source attribute
+ */
+ XPathExpression getSourceXPathExpression();
+
+ /**
+ * Set the XPath expression for the source attribute
+ * @param sourceXPathExpression the XPath expression for the source attribute
+ */
+ void setSourceXPathExpression(XPathExpression sourceXPathExpression);
+
+ /**
+ * Returns a URI to a file containing the property value.
+ *
+ * @return a URI to a file containing the property value
+ */
+ String getFile();
+
+ /**
+ * Sets a URI to a file containing the property value.
+ *
+ * @param file a URI to a file containing the property value
+ */
+ void setFile(String file);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
new file mode 100644
index 0000000000..ad72780de8
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
@@ -0,0 +1,113 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * An instance of a reference associated with a particular component.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface ComponentReference extends Reference {
+
+ /**
+ * Returns the reference defined by the implementation for this reference.
+ *
+ * @return the implementation reference
+ */
+ Reference getReference();
+
+ /**
+ * Sets the reference defined by the implementation for this reference.
+ *
+ * @param reference the implementation reference
+ */
+ void setReference(Reference reference);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+ /**
+ * Returns the callback service created internally as a target endpoint
+ * for callbacks to this reference.
+ *
+ * @return the callback service
+ */
+ ComponentService getCallbackService();
+
+ /**
+ * Sets the callback service created internally as a target endpoint
+ * for callbacks to this reference.
+ *
+ * @param callbackService the callback service
+ */
+ void setCallbackService(ComponentService callbackService);
+
+ /**
+ * A boolean value, "false" by default, which indicates whether this component reference
+ * can have its targets overridden by a composite reference which promotes the
+ * component reference.
+ *
+ * If @nonOverridable==false, the target(s) of the promoting composite reference
+ * replace all the targets explicitly declared on the component reference for any
+ * value of @multiplicity on the component reference.
+ *
+ * If the component reference has @nonOverridable==false and @multiplicity 1..1
+ * and the reference has a target, then any composite reference which promotes
+ * the component reference has @multiplicity 0..1.by default and MAY have an explicit @multiplicity of either
+ * 0..1 or 1..1.
+ *
+ * If @nonOverridable==true, and the component reference has @multiplicity 0..1 or
+ * 1..1 and the component reference also declares a target, promotion implies
+ * that the promoting composite reference has @wiredbyImpl==true and the composite
+ * reference cannot supply a target, but can influence the policy attached to the
+ * component reference.
+ *
+ * If @nonOverridable==true, and the component reference @multiplicity is 0..n
+ * or 1..n, promotion targeting is additive
+ *
+ * @return
+ */
+ boolean isNonOverridable();
+
+ /**
+ * Set the nonOverridable flag
+ * @param nonOverridable
+ */
+ void setNonOverridable(boolean nonOverridable);
+
+ /**
+ * Sets whether this Component Reference is promoted
+ * @param isPromoted - true if the component reference is promoted
+ */
+ void setPromoted(boolean isPromoted);
+
+ boolean isPromoted();
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
new file mode 100644
index 0000000000..e1e3eab90c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * An addressable instance of a service associated with a particular component.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface ComponentService extends Service {
+
+ /**
+ * Returns the service defined by the implementation for this service.
+ *
+ * @return
+ */
+ Service getService();
+
+ /**
+ * Sets the service defined by the implementation for this service.
+ *
+ * @param service
+ */
+ void setService(Service service);
+
+ /**
+ * Returns the callback reference created internally as a source endpoint
+ * for callbacks from this service.
+ *
+ * @return the callback reference
+ */
+ ComponentReference getCallbackReference();
+
+ /**
+ * Sets the callback reference created internally as a source endpoint
+ * for callbacks from this service.
+ *
+ * @param callbackReference the callback reference
+ */
+ void setCallbackReference(ComponentReference callbackReference);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
new file mode 100644
index 0000000000..f748828999
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
@@ -0,0 +1,90 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Describes an implementation and represents its configurable aspects.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface ComponentType extends Base, PolicySubject {
+
+ /**
+ * Returns the URI of this component type.
+ * @return the URI of the component type
+ */
+ String getURI();
+
+ /**
+ * Sets the URI of this component type.
+ * @param uri the URI of the component type
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns a list of services that are offered.
+ *
+ * @return a list of services that are offered
+ */
+ List<Service> getServices();
+
+ /**
+ * Return a service by name
+ *
+ * @param name the service name
+ * @return service the service
+ */
+ Service getService(String name);
+
+ /**
+ * Returns the list of reference types that are used.
+ *
+ * @return the list of reference types that are used
+ */
+ List<Reference> getReferences();
+
+ /**
+ * Return a reference by name
+ *
+ * @param name the reference name
+ * @return reference the reference
+ */
+ Reference getReference(String name);
+
+ /**
+ * Returns the list of properties that can be set.
+ *
+ * @return the list of properties that can be set
+ */
+ List<Property> getProperties();
+
+ /**
+ * Return a property by name
+ *
+ * @param name the property name
+ * @return property the property
+ */
+ Property getProperty(String name);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
new file mode 100644
index 0000000000..2c619be680
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
@@ -0,0 +1,137 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Composite extends Implementation, Extensible, Cloneable, PolicySubject {
+ /**
+ * Special name for the domain composite
+ */
+ QName DOMAIN_COMPOSITE = new QName(SCA11_NS, "");
+ QName TYPE = new QName(SCA11_NS, "implementation.composite");
+
+ /**
+ * Returns the spec version of the composite used to build this model
+ *
+ * @return the spec version used to build this model
+ */
+ String getSpecVersion();
+
+ /**
+ * Sets the spec version of the composite used to build this model
+ *
+ * @param specVersion the spec version used to build this model
+ */
+ void setSpecVersion(String specVersion);
+
+ String getContributionURI();
+ void setContributionURI(String contributionURI);
+
+ /**
+ * Returns the name of the composite.
+ *
+ * @return the name of the composite
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the composite.
+ *
+ * @param name the name of the composite
+ */
+ void setName(QName name);
+
+ /**
+ * Returns a list of composites included in this composite.
+ *
+ * @return a list of composites included in this composite.
+ */
+ List<Composite> getIncludes();
+
+ public List<Composite> getFusedIncludes();
+
+ /**
+ * Returns a list of components contained in this composite.
+ *
+ * @return a list of components contained in this composite
+ */
+ List<Component> getComponents();
+
+ /**
+ * Returns a component by name
+ */
+ Component getComponent(String name);
+
+ /**
+ * Returns a list of wires contained in this composite.
+ *
+ * @return a list of wires contained in this composite
+ */
+ List<Wire> getWires();
+
+ /**
+ * Returns true if all the components within the composite must run in the
+ * same process.
+ *
+ * @return true if all the components within the composite must run in the
+ * same process
+ */
+ boolean isLocal();
+
+ /**
+ * Sets whether all the components within the composite must run in the same
+ * process.
+ *
+ * @param local whether all the components within the composite must run in
+ * the same process
+ */
+ void setLocal(boolean local);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+ /**
+ * Returns a clone of the component type.
+ *
+ * @return a clone of the component type
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
new file mode 100644
index 0000000000..88cb2f9a2c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+/**
+ * Represents composite reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeReference extends Reference {
+ /**
+ * Returns the promoted components. For each promoted component/reference,
+ * they have the same index in the component and reference list.
+ *
+ * @return the promoted components
+ */
+ List<Component> getPromotedComponents();
+
+ /**
+ * Returns the promoted component references.
+ *
+ * @return the promoted component references
+ */
+ List<ComponentReference> getPromotedReferences();
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
new file mode 100644
index 0000000000..575d0784ce
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
@@ -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.sca.assembly;
+
+/**
+ * Represents a composite service.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface CompositeService extends Service {
+
+ /**
+ * Returns the promoted component.
+ *
+ * @return the promoted component.
+ */
+ Component getPromotedComponent();
+
+ /**
+ * Sets the promoted component
+ *
+ * @param promotedComponent the promoted component.
+ */
+ void setPromotedComponent(Component promotedComponent);
+
+ /**
+ * Returns the promoted component service .
+ *
+ * @return the promoted component service.
+ */
+ ComponentService getPromotedService();
+
+ /**
+ * Sets the promoted component service
+ *
+ * @param promotedService the promoted component service.
+ */
+ void setPromotedService(ComponentService promotedService);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
new file mode 100644
index 0000000000..25ae82aa8f
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
@@ -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.sca.assembly;
+
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents an Operation. Typically Operation elements are used when there is a
+ * need to apply certain facets such as intents and policysets only to a specific
+ * operation provided by a service or reference.
+ *
+ * @tuscany.spi.extension.asclient
+ * @version $Rev$ $Date$
+ */
+public interface ConfiguredOperation extends Base, PolicySubject {
+ /**
+ * Returns the name of the operation.
+ *
+ * @return the name of the operation
+ */
+ String getName();
+
+ /**
+ * Sets the name of the operation.
+ *
+ * @param name the name of the operation
+ */
+ void setName(String name);
+
+ /**
+ * Returns the name of the service or reference to which this operation belongs.
+ * This method is particularly useful when operation elements are specified under implementation
+ * elements and it is necessary to identify which of the various services provided by the
+ * implementation is referred to by the operation element in question
+ *
+ * @return the name of the contract to which this operation belongs
+ */
+ String getContractName();
+
+ /**
+ * Sets the name of the service or reference to which this operation belongs.
+ *
+ * @param contractName the name of the contract to which this operation belongs
+ */
+ void setContractName(String contractName);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
new file mode 100644
index 0000000000..b3a1bf9b16
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
@@ -0,0 +1,118 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents a contract. A contract can be either a service or a reference.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Contract extends AbstractContract, PolicySubject, Cloneable {
+
+ /**
+ * Returns the bindings supported by this contract.
+ *
+ * @return the bindings supported by this contract
+ */
+ List<Binding> getBindings();
+
+ /**
+ * Return the named binding
+ *
+ * @return the named binding or null if it can't be found
+ */
+ Binding getBinding(String name);
+
+ /**
+ * 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 binding of the specified type or null if there is no such
+ * callback binding configured on this contract.
+ *
+ * @param <B> the callback binding type
+ * @param bindingClass the callback binding type class
+ * @return the callback binding or null if there is no callback binding of the specified type
+ */
+ <B> B getCallbackBinding(Class<B> bindingClass);
+
+ /**
+ * Returns a callback definition of the bindings to use for callbacks.
+ *
+ * @return a definition of the bindings to use for callbacks
+ */
+ Callback getCallback();
+
+ /**
+ * Sets a callback definition of the bindings to use for callbacks
+ *
+ * @param callback a definition of the bindings to use for callbacks
+ */
+ void setCallback(Callback callback);
+
+ /**
+ * Returns a clone of the contract.
+ *
+ * @return a clone of the reference
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Returns the interface contract given a binding. Important in the case where
+ * a reference with multiplicity > 1 has been promoted and has it's list of
+ * resolved bindings extended by a promoting reference. Here the binding
+ * from the promoting reference may need the interface contract from the
+ * promoting reference and not the promoted reference.
+ * TODO - remove this wrinkle with better endpoint support.
+ *
+ * @param binding the binding for which the interface contract is required
+ * @return the interface contract
+ */
+ InterfaceContract getInterfaceContract(Binding binding);
+
+ /**
+ * A flag to tell if there are any binding elements specified for this service or reference.
+ * If true, they override the the bindings in the corresponding reference/service in the
+ * component type or promoted reference/service.
+ * @return
+ */
+ boolean isOverridingBindings();
+
+ /**
+ * Set the flag depending on if there are any binding elements specified for this service or
+ * reference.
+ * @param overridingBindings true if there are binding elements specified
+ */
+ void setOverridingBindings(boolean overridingBindings);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
new file mode 100644
index 0000000000..6d8350fc66
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
@@ -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.sca.assembly;
+
+import org.apache.tuscany.sca.assembly.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+/**
+ * A factory for the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory {
+
+ public DefaultAssemblyFactory(ExtensionPointRegistry registry) {
+ super(registry);
+ }
+
+ public DefaultAssemblyFactory() {
+ super(new DefaultExtensionPointRegistry());
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
new file mode 100644
index 0000000000..014913cfa8
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
@@ -0,0 +1,179 @@
+/*
+ * 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.sca.assembly;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents a service endpoint which is what results from having a configured
+ * binding applied to a component service. In a deployed application an endpoint
+ * will relate directly to a physical endpoint, for example, a HTTP URL or a
+ * JMS destination.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Endpoint extends Base, PolicySubject, Cloneable, Serializable {
+
+ /**
+ * Get the structural URI of the service binding
+ * @return structural URI of the service/binding
+ */
+ String getURI();
+
+ /**
+ * Set the structural URI of the service binding
+ * @param uri &lt;componentURI&gt;#service-binding(serviceName/bindingName)
+ * or &lt;componentURI&gt;#service(serviceName)
+ */
+ void setURI(String uri);
+
+ /**
+ * Get the deployed URI
+ * @return The deployed URI
+ */
+ String getDeployedURI();
+ /**
+ * Set the deployed URI
+ * @param deployedURI
+ */
+ void setDeployedURI(String deployedURI);
+
+ /**
+ * Get the component model object
+ *
+ * @return component
+ */
+ Component getComponent();
+
+ /**
+ * Set the component model object
+ *
+ * @param component
+ */
+ void setComponent(Component component);
+
+ /**
+ * Get the service model object
+ *
+ * @return service
+ */
+ ComponentService getService();
+
+ /**
+ * Set the service model object
+ *
+ * @param service
+ */
+ void setService(ComponentService service);
+
+ /**
+ * Get the resolved target binding
+ *
+ * @return target binding
+ */
+ Binding getBinding();
+
+ /**
+ * Set the binding
+ *
+ * @param binding
+ */
+ void setBinding(Binding binding);
+
+ /**
+ * Returns the interface contract defining the interface
+ *
+ * @return the interface contract
+ */
+ InterfaceContract getComponentServiceInterfaceContract();
+
+ /**
+ * Get the service's callback endpoint references that
+ * represent endpoint references from which callbacks
+ * originate
+ *
+ * @return callbackEndpoint the reference callback endpoint
+ */
+ List<EndpointReference> getCallbackEndpointReferences();
+
+ /**
+ * Returns true if this endpoint represents a serivce that is not
+ * running in this JVM
+ *
+ * @return true if the endpoint is remote
+ */
+ boolean isRemote();
+
+ /**
+ * Set true if this endpoint represents a serivce that is not
+ * running in this JVM
+ *
+ * @param remote set to true if the endpoint is remote
+ */
+ void setRemote(boolean remote);
+
+ /**
+ * Supports endpoint cloning
+ *
+ * @return endpoint
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Tests if the URI of this endpoint matches the service URI
+ * @param serviceName the service URI to test
+ * @return true if the endpoint URI matches the service URI
+ */
+ boolean matches(String serviceURI);
+
+ /**
+ * When true this endpoint is able to process the invocation
+ * asynchronously. The forward call is effectively one-way
+ * and the response will arrive asynchronously
+ *
+ * @return true if the service is asynchronous
+ */
+ boolean isAsyncInvocation();
+
+ /**
+ * Get the spec version for this endpoint. This is intended to help
+ * interop scenarios where having an OASIS endpoint talk to an
+ * OSOA endpoint implies some restrictions.
+ *
+ * @return the spec version, namespace for either SCA-1.0 or SCA-1.1
+ */
+ String getSpecVersion();
+
+ /**
+ * Set the spec version for this endpoint. This is intended to help
+ * interop scenarios where having an OASIS endpoint talk to an
+ * OSOA endpoint implies some restrictions. If unset it defaults
+ * to the namespace for SCA-1.1
+ *
+ * @param specVersion the spec version, namspace for either SCA-1.0 or SCA-1.1
+ */
+ void setSpecVersion(String specVersion);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java
new file mode 100644
index 0000000000..f4f1cd2a8d
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java
@@ -0,0 +1,185 @@
+/*
+ * 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.sca.assembly;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents an endpoint reference. An SCA reference can reference service endpoints in a
+ * number of ways. Target names, autowire, configured bindings. The endpoint reference
+ * captures the result of specifying one of these things.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface EndpointReference extends Base, PolicySubject, Cloneable, Serializable {
+
+ /**
+ * Status of the endpoint reference resolution
+ */
+ enum Status {
+ NOT_CONFIGURED, // Not configured
+ RESOLVED_BINDING, // The endpoint reference is configured with a binding
+ AUTOWIRE_PLACEHOLDER, // Autowire to be performed
+ WIRED_TARGET_NOT_FOUND, // Wire target not found
+ WIRED_TARGET_FOUND_READY_FOR_MATCHING, // Wire target found and ready to be resolved to an endpoint
+ WIRED_TARGET_FOUND_AND_MATCHED, // Wire target found and resolved to an endpoint
+ WIRED_TARGET_IN_BINDING_URI // SCA target specified by the binding uri
+ };
+
+ /**
+ * Get the structural URI of the reference binding
+ * @return The structural URI of the reference/binding
+ */
+ String getURI();
+
+ /**
+ * Set the structural URI of the reference binding
+ * @param uri &lt;componentURI&gt;#reference-binding(referenceName/bindingName)
+ * or &lt;componentURI&gt;#reference(referenceName) if binding is not present
+ *
+ */
+ void setURI(String uri);
+
+ /**
+ * Supports endpoint reference cloning
+ *
+ * @return endpointReference
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Get the component model object
+ *
+ * @return component
+ */
+ Component getComponent();
+
+ /**
+ * Set the component model object
+ *
+ * @param component the component for the endpoint
+ */
+ void setComponent(Component component);
+
+ /**
+ * Get the source component reference model object
+ *
+ * @return reference the source component reference for the endpoint
+ */
+ ComponentReference getReference();
+
+ /**
+ * Set the source component reference model object
+ *
+ * @param reference
+ */
+ void setReference(ComponentReference reference);
+
+ /**
+ * Get the resolved reference binding
+ *
+ * @return binding the resolved reference binding
+ */
+ Binding getBinding();
+
+ /**
+ * Set the resolved reference binding
+ *
+ * @param binding the resolved reference binding
+ */
+ void setBinding(Binding binding);
+
+ /**
+ * Get the target endpoint
+ *
+ * @return endpoint the target endpoint
+ */
+ Endpoint getTargetEndpoint();
+
+ /**
+ * Set the target endpoint model object
+ *
+ * @param endpoint the target endpoint
+ */
+ void setTargetEndpoint(Endpoint targetEndpoint);
+
+ /**
+ * Get the deployed URI of the corresponding service endpoint
+ * @return The deployed URI
+ */
+ String getDeployedURI();
+ /**
+ * Set the deployed URI
+ * @param deployedURI
+ */
+ void setDeployedURI(String deployedURI);
+
+ /**
+ * Returns the interface contract defining the interface
+ *
+ * @return the interface contract
+ */
+ InterfaceContract getComponentReferenceInterfaceContract();
+
+ /**
+ * Get the reference callback endpoint that
+ * represents that target endpoint to which callback
+ * messages will be directed
+ *
+ * @return callbackEndpoint the reference callback endpoint
+ */
+ Endpoint getCallbackEndpoint();
+
+ /**
+ * Set the reference callback endpoint
+ *
+ * @param callbackEndpoint the reference callback endpoint
+ */
+ void setCallbackEndpoint(Endpoint callbackEndpoint);
+
+ /**
+ * Rather than relying on combinations of unresolved flags and
+ * other data we maintain a status enumeration
+ *
+ * @return status
+ */
+ Status getStatus();
+
+ /**
+ * Rather than relying on combinations of unresolved flags and
+ * other data we maintain a status enumeration
+ *
+ * @param status the new status
+ */
+ void setStatus(Status status);
+
+ /**
+ * When true this endpoint reference is able to process the invocation
+ * asynchronously. The forward call is effectively one-way
+ * and the response will arrive asynchronously
+ *
+ * @return true if the reference is asynchronous
+ */
+ boolean isAsyncInvocation();
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
new file mode 100644
index 0000000000..da8d054140
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
@@ -0,0 +1,45 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+/**
+ * Base interface for extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface Extensible extends Base {
+
+ /**
+ * Returns a list of extension objects contained in this model object.
+ *
+ * @return a list of extension objects container in this model object
+ */
+ List<Object> getExtensions();
+
+ /**
+ * Returns a list of attribute extensions contained in this model object
+ *
+ * @return a list of attribute extensions contained in this model object
+ */
+ List<Extension> getAttributeExtensions();
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java
new file mode 100644
index 0000000000..d179ce7b3b
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java
@@ -0,0 +1,66 @@
+/*
+ * 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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Base interface for storing contents of extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Extension {
+
+ /**
+ * Return QName for the extension
+ * @return the extension QName
+ */
+ QName getQName();
+
+ /**
+ * Set QName for the extension
+ * @param qName the extension QName
+ */
+ void setQName(QName qName);
+
+ /**
+ * Return the original extension value
+ * @return the extension value
+ */
+ <T> T getValue();
+
+ /**
+ * Set the original extension value
+ * @param value the extension value
+ */
+ <T> void setValue(T value);
+
+ /**
+ * Return whether or not the extension is an attribute
+ * @return
+ */
+ boolean isAttribute();
+
+ /**
+ * Set whether or not the extension is an attribute
+ * @param value
+ */
+ void setAttribute(boolean isAttribute);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
new file mode 100644
index 0000000000..3912896f0c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
@@ -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.sca.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Represents a component implementation.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface Implementation extends ComponentType {
+ QName getType();
+ List<Operation> getOperations();
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
new file mode 100644
index 0000000000..5b719e50bc
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
@@ -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.sca.assembly;
+
+/**
+ * Enumeration for multiplicity. Defines the number of wires that can connect a
+ * reference to target services.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension
+ */
+public enum Multiplicity {
+
+ /**
+ * Zero or one wire can have the reference as a source.
+ */
+ ZERO_ONE,
+
+ /**
+ * The default setting, one wire can have the reference as a source.
+ */
+ ONE_ONE,
+
+ /**
+ * Zero or more wires can have the reference as a source.
+ */
+ ZERO_N,
+
+ /**
+ * One or more wires can have the reference as a source.
+ */
+ ONE_N
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java
new file mode 100644
index 0000000000..9df72e358d
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java
@@ -0,0 +1,29 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * Represents an operationSelector
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface OperationSelector extends Base, Cloneable {
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
new file mode 100644
index 0000000000..9563d2e1cb
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
@@ -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 org.apache.tuscany.sca.assembly;
+
+import java.util.List;
+
+/**
+ * Interface to be implemented by SCA artifacts that support configuration of 'operation' child
+ * elements for policies etc.
+ * @tuscany.spi.extension.inheritfrom
+ * @version $Rev$ $Date$
+ */
+
+public interface OperationsConfigurator {
+ List<ConfiguredOperation> getConfiguredOperations();
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
new file mode 100644
index 0000000000..c65b6213b0
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sca.assembly;
+
+/**
+ * A property allows for the configuration of an implementation with externally
+ * set data values. An implementation can have zero or more properties. Each
+ * property has a data type, which may be either simple or complex. An
+ * implementation may also define a default value for a property.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Property extends AbstractProperty, Cloneable {
+
+ /**
+ * Returns a clone of the property.
+ *
+ * @return a clone of the property
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
new file mode 100644
index 0000000000..db677bdabb
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
@@ -0,0 +1,80 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+/**
+ * Represents a reference. References within an implementation represent links
+ * to services that the implementation uses that must be provided by other
+ * components.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Reference extends AbstractReference, Contract {
+
+ /**
+ * Returns a boolean value, "false" by default, which indicates that the
+ * implementation wires this reference dynamically.
+ *
+ * @return true if the implementation wires this reference dynamically
+ */
+ boolean isWiredByImpl();
+
+ /**
+ * Sets a boolean value, "false" by default, which indicates that the
+ * implementation wires this reference dynamically.
+ *
+ * @param wiredByImpl whether the implementation wires this reference
+ * dynamically
+ */
+ void setWiredByImpl(boolean wiredByImpl);
+
+
+ /**
+ * Returns the targets of this reference.
+ *
+ * @return the targets of this reference.
+ */
+ List<ComponentService> getTargets();
+
+ /**
+ * Returns the endpoint references implied by this reference.
+ *
+ * Endpoint references are used to represent:
+ *
+ * - manually specified reference targets
+ * - reference targets determined by autowire
+ * - manually configured remote bindings
+ *
+ * @return the endpoint references implied by this reference
+ */
+ List<EndpointReference> getEndpointReferences();
+
+ /**
+ * Indicate if the reference allows pass by reference for remotable operations
+ */
+ boolean isAllowsPassByReference();
+
+ /**
+ * @param allowsPassByReference the allowsPassByReference to set
+ */
+ void setAllowsPassByReference(boolean allowsPassByReference);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
new file mode 100644
index 0000000000..317655ee98
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
@@ -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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABinding extends Binding {
+ QName TYPE = new QName(SCA11_NS, "binding.sca");
+
+ /**
+ * Retrieve the type of the binding that this binding.sca
+ * delegates to
+ *
+ * @return delegate binding type
+ */
+ String getDelegateBindingType();
+
+ /**
+ * Set the type of the binding that this binding.sca
+ * delegates to
+ *
+ * @param delegateBindingType
+ */
+ void setDelegateBindingType(String delegateBindingType);
+
+ /**
+ * Get the URI for the binding that this binding.sca
+ * delegates to
+ *
+ * @return delegate binding URI
+ */
+ String getDelegateBindingURI();
+
+ /**
+ * Set the URI for the binding that this binding.sca
+ * delegates to
+ *
+ * @param delegateBindingURI
+ */
+ void setDelegateBindingURI(String delegateBindingURI);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
new file mode 100644
index 0000000000..feae980326
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
@@ -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 org.apache.tuscany.sca.assembly;
+
+/**
+ * A factory for the SCA binding model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABindingFactory {
+
+ /**
+ * Create a new SCA binding.
+ *
+ * @return a new SCA binding
+ */
+ SCABinding createSCABinding();
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
new file mode 100644
index 0000000000..9caa7563c9
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sca.assembly;
+
+import java.util.List;
+
+/**
+ * Represents a service. Services are used to publish services provided by
+ * implementations, so that they are addressable by other components.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface Service extends AbstractService, Contract {
+ /**
+ * Returns the endpoints implied by this service.
+ *
+ * Endpoints represent configured bindings for a service. Hence a service
+ * with two bindings will expose two Endpoints. Where a promoted service has
+ * new binding configuration applied by a promoting component Endpoints are
+ * introduced to represent these new bindings.
+ *
+ * @return the endpoints implied by this service
+ */
+ List<Endpoint> getEndpoints();
+
+
+ /**
+ * Returns true if this service was defined based on JAXWS annotations
+ * in a Java implementation
+ *
+ * @return
+ */
+ boolean isJAXWSService();
+
+ /**
+ * Allows the JAXWSService flag to be set. It should be set true if the service
+ * configuration has been affected by JAXWS annotations.
+ *
+ * @param isJAXWSService
+ */
+ void setJAXWSService(boolean isJAXWSService);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
new file mode 100644
index 0000000000..075b50eec1
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
@@ -0,0 +1,85 @@
+/*
+ * 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.sca.assembly;
+
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Represents a wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Wire extends Base, Extensible, PolicySubject, Cloneable {
+
+ /**
+ * Returns the source of the wire.
+ *
+ * @return the source of the wire
+ */
+ ComponentReference getSource();
+
+ /**
+ * Sets the source of the wire.
+ *
+ * @param source the source of the wire
+ */
+ void setSource(ComponentReference source);
+
+ /**
+ * Returns the target of the wire.
+ *
+ * @return the target of the wire
+ */
+ ComponentService getTarget();
+
+ /**
+ * Sets the target of the wire.
+ *
+ * @param target the target of the wire
+ */
+ void setTarget(ComponentService target);
+
+ /**
+ * A boolean value, with the default of "false". When a wire element has
+ * @replace="false", the wire is added to the set of wires which apply to
+ * the reference identified by the @source attribute. When a wire element
+ * has @replace="true", the wire is added to the set of wires which apply to
+ * the reference identified by the @source attribute - but any wires for that
+ * reference specified by means of the @target attribute of the reference
+ * are removed from the set of wires which apply to the reference.
+ *
+ * @return
+ */
+ boolean isReplace();
+
+ /**
+ * Set the replace flag for the wire
+ * @param replace
+ */
+ void setReplace(boolean replace);
+
+ /**
+ * Returns a clone of the wire.
+ *
+ * @return a clone of the wire
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java
new file mode 100644
index 0000000000..c622737454
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java
@@ -0,0 +1,31 @@
+/*
+ * 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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a wireFormat.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface WireFormat extends Base, Cloneable {
+ QName getSchemaName();
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java
new file mode 100644
index 0000000000..8c56385c9e
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java
@@ -0,0 +1,54 @@
+/*
+ * 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.sca.assembly.builder;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Contract;
+
+/**
+ * A builder that handles any build-time configuration needed by bindings.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface BindingBuilder<B extends Binding> {
+
+ /**
+ * Configure a binding.
+ *
+ * @param component The component for the binding's service or reference
+ * @param contract The binding's service or reference
+ * @param context The context for the builder
+ * @param rebuild Set true to have derived data in the binding rebuilt
+ * caching can cause problems in the late binding case so we
+ * need to be able to remove cached data
+ */
+ void build(Component component, Contract contract, B binding, BuilderContext context, boolean rebuild);
+
+ /**
+ * Get QName of the binding type
+ * @return The binding type
+ */
+ QName getBindingType();
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java
new file mode 100644
index 0000000000..374c36c1f5
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java
@@ -0,0 +1,107 @@
+/*
+ * 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.sca.assembly.builder;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.Definitions;
+import org.apache.tuscany.sca.monitor.DefaultMonitorFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+
+/**
+ * Context for builders
+ * @tuscany.spi.extension.asclient
+ */
+public class BuilderContext {
+ protected Definitions definitions;
+ protected Map<QName, List<String>> bindingBaseURIs = Collections.emptyMap();
+ protected Monitor monitor;
+
+ /**
+ * @param definitions
+ * @param bindingBaseURIs
+ * @param monitor
+ */
+ public BuilderContext(Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor) {
+ super();
+ this.definitions = definitions;
+ if (bindingBaseURIs != null) {
+ this.bindingBaseURIs = bindingBaseURIs;
+ }
+ this.monitor = monitor;
+ }
+
+ /**
+ * Create a builder context with the monitor
+ * @param monitor
+ */
+ public BuilderContext(Monitor monitor) {
+ super();
+ this.monitor = monitor;
+ }
+
+ /**
+ * Create a builder context with the extension point registry
+ * @param registry
+ */
+ public BuilderContext(ExtensionPointRegistry registry) {
+ super();
+ MonitorFactory monitorFactory =
+ registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(MonitorFactory.class);
+ this.monitor = monitorFactory.createMonitor();
+ }
+
+ /**
+ * Create a builder context with a default monitor
+ */
+ public BuilderContext() {
+ super();
+ this.monitor = new DefaultMonitorFactory().createMonitor();
+ }
+
+ public Monitor getMonitor() {
+ return monitor;
+ }
+
+ public Monitor setMonitor(Monitor monitor) {
+ Monitor old = this.monitor;
+ this.monitor = monitor;
+ return old;
+ }
+
+ public Definitions getDefinitions() {
+ return definitions;
+ }
+
+ public Map<QName, List<String>> getBindingBaseURIs() {
+ return bindingBaseURIs;
+ }
+
+ public void setDefinitions(Definitions definitions) {
+ this.definitions = definitions;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java
new file mode 100644
index 0000000000..14ae2042d3
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java
@@ -0,0 +1,149 @@
+/*
+ * 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.sca.assembly.builder;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * An extension point for Composite builders.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.asclient
+ */
+public interface BuilderExtensionPoint {
+
+ /**
+ * Adds a contract builder.
+ *
+ * @param compositeBuilder
+ */
+ void addContractBuilder(ContractBuilder contractBuilder);
+
+ /**
+ * Removes a contract builder.
+ *
+ * @param compositeBuilder
+ */
+ void removeContractBuilder(ContractBuilder contractBuilder);
+
+ /**
+ * Returns the contract builder
+ *
+ * @param id
+ * @return
+ */
+ ContractBuilder getContractBuilder();
+
+ /**
+ * Adds a composite builder.
+ *
+ * @param compositeBuilder
+ */
+ void addCompositeBuilder(CompositeBuilder compositeBuilder);
+
+ /**
+ * Removes a composite builder.
+ *
+ * @param compositeBuilder
+ */
+ void removeCompositeBuilder(CompositeBuilder compositeBuilder);
+
+ /**
+ * Returns the composite builder with the given id.
+ *
+ * @param id
+ * @return
+ */
+ CompositeBuilder getCompositeBuilder(String id);
+
+ /**
+ * Add a binding builder
+ * @param bindingBuilder
+ */
+ void addBindingBuilder(BindingBuilder<?> bindingBuilder);
+
+ /**
+ * Look up a binding builder by the binding type
+ * @param <B>
+ * @param bindingType
+ * @return
+ */
+ <B extends Binding> BindingBuilder<B> getBindingBuilder(QName bindingType);
+
+ /**
+ * Remove a binding builder
+ * @param <B>
+ * @param builder
+ */
+ <B extends Binding> void removeBindingBuilder(BindingBuilder<B> builder);
+
+ /**
+ * Add an implementation builder
+ * @param implementationBuilder
+ */
+ void addImplementationBuilder(ImplementationBuilder<?> implementationBuilder);
+
+ /**
+ * Look up an implementation builder by implementation type
+ * @param <I>
+ * @param implementationType
+ * @return
+ */
+ <I extends Implementation> ImplementationBuilder<I> getImplementationBuilder(QName implementationType);
+
+ /**
+ * Remove an implementation builder
+ * @param <I>
+ * @param builder
+ */
+ <I extends Implementation> void removeImplementationBuilder(ImplementationBuilder<I> builder);
+
+ /**
+ * Add a policy builder
+ * @param policyBuilder
+ */
+ void addPolicyBuilder(PolicyBuilder<?> policyBuilder);
+
+ /**
+ * Look up a Policy builder by the Policy type
+ * @param <P>
+ * @param policyType
+ * @return
+ */
+ <P> PolicyBuilder<P> getPolicyBuilder(QName policyType);
+
+ /**
+ * Remove a Policy builder
+ * @param <P>
+ * @param builder
+ */
+ <P> void removePolicyBuilder(PolicyBuilder<P> builder);
+
+ /**
+ * Get a collection of policy builders
+ * @return
+ */
+ public Collection<PolicyBuilder> getPolicyBuilders();
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
new file mode 100644
index 0000000000..50bf10f54a
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
@@ -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 org.apache.tuscany.sca.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Composite;
+
+/**
+ * A builder that handles the configuration of the components inside a
+ * composite and the wiring of component references to component services.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeBuilder {
+
+ /**
+ * Returns the ID of the builder.
+ *
+ * @return An ID that identifies the builder
+ */
+ String getID();
+
+ /**
+ * Build a composite.
+ *
+ * @param composite The composite
+ * @param context The builder context
+ * @return The composite built from the original one. In most cases, it is the same as the orginal one as
+ * most builders only change the content of the composite.
+ *
+ * @throws CompositeBuilderException
+ */
+ Composite build(Composite composite, BuilderContext context) throws CompositeBuilderException;
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
new file mode 100644
index 0000000000..5a2015f55e
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
@@ -0,0 +1,45 @@
+/*
+ * 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.sca.assembly.builder;
+
+/**
+ * Reports a composite builder exception.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderException extends Exception {
+ private static final long serialVersionUID = -8916323176803443856L;
+
+ public CompositeBuilderException() {
+ }
+
+ public CompositeBuilderException(String message) {
+ super(message);
+ }
+
+ public CompositeBuilderException(Throwable cause) {
+ super(cause);
+ }
+
+ public CompositeBuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ContractBuilder.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ContractBuilder.java
new file mode 100644
index 0000000000..99a58dc1c8
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ContractBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * 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.sca.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * A builder that builds WSDL versions of component contracts so that the
+ * component contracts can be compared with binding contracts in a generic way.
+ * The generic interface format defined by the Assembly spec is WSDL 1.1
+ */
+public interface ContractBuilder {
+
+ /**
+ * Build the WSDL version of the Interface Contract
+ */
+ boolean build(InterfaceContract interfaceContract, BuilderContext context);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java
new file mode 100644
index 0000000000..8b037a7534
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java
@@ -0,0 +1,479 @@
+/*
+ * 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.sca.assembly.builder;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.core.LifeCycleListener;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDeclarationParser;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint, LifeCycleListener {
+
+ private ExtensionPointRegistry registry;
+ private final Map<String, CompositeBuilder> builders = new HashMap<String, CompositeBuilder>();
+ private final Map<QName, BindingBuilder> bindingBuilders = new HashMap<QName, BindingBuilder>();
+ private final Map<QName, ImplementationBuilder> implementationBuilders =
+ new HashMap<QName, ImplementationBuilder>();
+ private final Map<QName, PolicyBuilder> policyBuilders = new HashMap<QName, PolicyBuilder>();
+ private ContractBuilder contractBuilder = null;
+
+ private boolean loaded;
+
+ public DefaultBuilderExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ builders.clear();
+ bindingBuilders.clear();
+ implementationBuilders.clear();
+ loaded = false;
+ }
+
+ public void addCompositeBuilder(CompositeBuilder builder) {
+ builders.put(builder.getID(), builder);
+ }
+
+ public void removeCompositeBuilder(CompositeBuilder builder) {
+ builders.remove(builder.getID());
+ }
+
+ public CompositeBuilder getCompositeBuilder(String id) {
+ loadBuilders();
+ return builders.get(id);
+ }
+
+ public void addContractBuilder(ContractBuilder contractBuilder){
+ this.contractBuilder = contractBuilder;
+ }
+
+ public void removeContractBuilder(ContractBuilder contractBuilder){
+ this.contractBuilder = null;
+ }
+
+ public ContractBuilder getContractBuilder(){
+ loadBuilders();
+ return contractBuilder;
+ }
+
+ /**
+ * Load builders declared under META-INF/services.
+ */
+ private synchronized void loadBuilders() {
+ if (loaded)
+ return;
+
+ FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+
+ UtilityExtensionPoint utils = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utils.getUtility(InterfaceContractMapper.class);
+
+ // Get the provider factory service declarations
+ Collection<ServiceDeclaration> builderDeclarations;
+ ServiceDiscovery serviceDiscovery = registry.getServiceDiscovery();
+ try {
+ builderDeclarations = serviceDiscovery.getServiceDeclarations(CompositeBuilder.class.getName());
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration builderDeclaration : builderDeclarations) {
+ Map<String, String> attributes = builderDeclaration.getAttributes();
+ String id = attributes.get("id");
+
+ CompositeBuilder builder = new LazyCompositeBuilder(id, builderDeclaration, this, factories, mapper);
+ builders.put(id, builder);
+ }
+
+ try {
+ builderDeclarations = serviceDiscovery.getServiceDeclarations(BindingBuilder.class);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration builderDeclaration : builderDeclarations) {
+ BindingBuilder<?> builder = new LazyBindingBuilder(builderDeclaration);
+ bindingBuilders.put(builder.getBindingType(), builder);
+ }
+
+ try {
+ builderDeclarations = serviceDiscovery.getServiceDeclarations(ImplementationBuilder.class);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration builderDeclaration : builderDeclarations) {
+ ImplementationBuilder<?> builder = new LazyImplementationBuilder(builderDeclaration);
+ implementationBuilders.put(builder.getImplementationType(), builder);
+ }
+
+ try {
+ builderDeclarations = serviceDiscovery.getServiceDeclarations(PolicyBuilder.class);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration builderDeclaration : builderDeclarations) {
+ PolicyBuilder<?> builder = new LazyPolicyBuilder(builderDeclaration);
+ policyBuilders.put(builder.getPolicyType(), builder);
+ }
+
+ try {
+ builderDeclarations = serviceDiscovery.getServiceDeclarations(ContractBuilder.class);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration builderDeclaration : builderDeclarations) {
+ contractBuilder = new LazyContractBuilder(builderDeclaration);
+ }
+
+
+ loaded = true;
+
+ }
+
+ public void addBindingBuilder(BindingBuilder<?> bindingBuilder) {
+ bindingBuilders.put(bindingBuilder.getBindingType(), bindingBuilder);
+ }
+
+ public <B extends Binding> BindingBuilder<B> getBindingBuilder(QName bindingType) {
+ loadBuilders();
+ return (BindingBuilder<B>)bindingBuilders.get(bindingType);
+ }
+
+ public <B extends Binding> void removeBindingBuilder(BindingBuilder<B> builder) {
+ bindingBuilders.remove(builder.getBindingType());
+ }
+
+ public void addImplementationBuilder(ImplementationBuilder<?> implementationBuilder) {
+ implementationBuilders.put(implementationBuilder.getImplementationType(), implementationBuilder);
+ }
+
+ public <I extends Implementation> ImplementationBuilder<I> getImplementationBuilder(QName implementationType) {
+ loadBuilders();
+ return (ImplementationBuilder<I>)implementationBuilders.get(implementationType);
+ }
+
+ public <I extends Implementation> void removeImplementationBuilder(ImplementationBuilder<I> builder) {
+ implementationBuilders.remove(builder.getImplementationType());
+ }
+
+ public void addPolicyBuilder(PolicyBuilder<?> policyBuilder) {
+ policyBuilders.put(policyBuilder.getPolicyType(), policyBuilder);
+ }
+
+ public <B> PolicyBuilder<B> getPolicyBuilder(QName policyType) {
+ loadBuilders();
+ return (PolicyBuilder<B>)policyBuilders.get(policyType);
+ }
+
+ public Collection<PolicyBuilder> getPolicyBuilders() {
+ loadBuilders();
+ return policyBuilders.values();
+ }
+
+ public <B> void removePolicyBuilder(PolicyBuilder<B> builder) {
+ policyBuilders.remove(builder.getPolicyType());
+ }
+
+ /**
+ * A wrapper around a composite builder allowing lazy
+ * loading and initialization of implementation providers.
+ */
+ private class LazyCompositeBuilder implements CompositeBuilder {
+
+ private FactoryExtensionPoint factories;
+ private InterfaceContractMapper mapper;
+ private String id;
+ private ServiceDeclaration builderDeclaration;
+ private CompositeBuilder builder;
+ private BuilderExtensionPoint builders;
+
+ private LazyCompositeBuilder(String id,
+ ServiceDeclaration factoryDeclaration,
+ BuilderExtensionPoint builders,
+ FactoryExtensionPoint factories,
+ InterfaceContractMapper mapper) {
+ this.id = id;
+ this.builderDeclaration = factoryDeclaration;
+ this.builders = builders;
+ this.factories = factories;
+ this.mapper = mapper;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public Composite build(Composite composite, BuilderContext context)
+ throws CompositeBuilderException {
+ return getBuilder().build(composite, context);
+ }
+
+ private CompositeBuilder getBuilder() {
+ if (builder == null) {
+ try {
+ Class<CompositeBuilder> builderClass = (Class<CompositeBuilder>)builderDeclaration.loadClass();
+ try {
+ Constructor<CompositeBuilder> constructor =
+ builderClass.getConstructor(FactoryExtensionPoint.class, InterfaceContractMapper.class);
+ builder = constructor.newInstance(factories, mapper);
+ } catch (NoSuchMethodException e) {
+ try {
+ Constructor<CompositeBuilder> constructor =
+ builderClass.getConstructor(BuilderExtensionPoint.class,
+ FactoryExtensionPoint.class,
+ InterfaceContractMapper.class);
+ builder = constructor.newInstance(builders, factories, mapper);
+ } catch (NoSuchMethodException ex) {
+ Constructor<CompositeBuilder> constructor =
+ builderClass.getConstructor(ExtensionPointRegistry.class);
+ builder = constructor.newInstance(registry);
+ }
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder;
+ }
+
+ }
+
+ private class LazyBindingBuilder implements BindingBuilder {
+ private ServiceDeclaration sd;
+ private BindingBuilder<?> builder;
+ private QName qname;;
+
+ /**
+ * @param sd
+ */
+ public LazyBindingBuilder(ServiceDeclaration sd) {
+ super();
+ this.sd = sd;
+ this.qname = ServiceDeclarationParser.getQName(sd.getAttributes().get("qname"));
+ }
+
+ public void build(Component component, Contract contract, Binding binding, BuilderContext context, boolean rebuild) {
+ getBuilder().build(component, contract, binding, context, rebuild);
+ }
+
+ public QName getBindingType() {
+ return qname;
+ }
+
+
+ private synchronized BindingBuilder getBuilder() {
+ if (builder == null) {
+ try {
+ Class<?> builderClass = sd.loadClass();
+ try {
+ Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
+ builder = (BindingBuilder)constructor.newInstance(registry);
+ } catch (NoSuchMethodException e) {
+ Constructor<?> constructor = builderClass.getConstructor();
+ builder = (BindingBuilder)constructor.newInstance();
+
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder;
+ }
+
+ }
+
+ private class LazyImplementationBuilder implements ImplementationBuilder {
+ private ServiceDeclaration sd;
+ private ImplementationBuilder<?> builder;
+ private QName qname;;
+
+ /**
+ * @param sd
+ */
+ public LazyImplementationBuilder(ServiceDeclaration sd) {
+ super();
+ this.sd = sd;
+ this.qname = ServiceDeclarationParser.getQName(sd.getAttributes().get("qname"));
+ }
+
+ public void build(Component component, Implementation implementation, BuilderContext context) {
+ getBuilder().build(component, implementation, context);
+ }
+
+ public QName getImplementationType() {
+ return qname;
+ }
+
+ private synchronized ImplementationBuilder getBuilder() {
+ if (builder == null) {
+ try {
+ Class<?> builderClass = sd.loadClass();
+ try {
+ Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
+ builder = (ImplementationBuilder)constructor.newInstance(registry);
+ } catch (NoSuchMethodException e) {
+ Constructor<?> constructor = builderClass.getConstructor();
+ builder = (ImplementationBuilder)constructor.newInstance();
+
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder;
+ }
+
+ }
+
+ private class LazyPolicyBuilder implements PolicyBuilder {
+ private ServiceDeclaration sd;
+ private PolicyBuilder<?> builder;
+ private QName qname;;
+
+ /**
+ * @param sd
+ */
+ public LazyPolicyBuilder(ServiceDeclaration sd) {
+ super();
+ this.sd = sd;
+ this.qname = ServiceDeclarationParser.getQName(sd.getAttributes().get("qname"));
+ }
+
+ public boolean build(Component component, Implementation implementation, BuilderContext context) {
+ return getBuilder().build(component, implementation, context);
+ }
+
+ public QName getPolicyType() {
+ return qname;
+ }
+
+ public List<QName> getSupportedBindings() {
+ return getBuilder().getSupportedBindings();
+ }
+
+ private synchronized PolicyBuilder getBuilder() {
+ if (builder == null) {
+ try {
+ Class<?> builderClass = sd.loadClass();
+ try {
+ Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
+ builder = (PolicyBuilder)constructor.newInstance(registry);
+ } catch (NoSuchMethodException e) {
+ Constructor<?> constructor = builderClass.getConstructor();
+ builder = (PolicyBuilder)constructor.newInstance();
+
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder;
+ }
+
+ public boolean build(Endpoint endpoint, BuilderContext context) {
+ return getBuilder().build(endpoint, context);
+ }
+
+ public boolean build(org.apache.tuscany.sca.assembly.EndpointReference endpointReference, BuilderContext context) {
+ return getBuilder().build(endpointReference, context);
+ }
+
+ public boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context) {
+ return getBuilder().build(endpointReference, endpoint, context);
+ }
+ }
+
+ private class LazyContractBuilder implements ContractBuilder {
+ private ServiceDeclaration sd;
+ private ContractBuilder builder;
+
+ /**
+ * @param sd
+ */
+ public LazyContractBuilder(ServiceDeclaration sd) {
+ super();
+ this.sd = sd;
+ }
+
+/*
+ public boolean build(EndpointReference endpointReference, BuilderContext context){
+ return getBuilder().build(endpointReference, context);
+ }
+
+ public boolean build(Endpoint endpoint, BuilderContext context){
+ return getBuilder().build(endpoint, context);
+ }
+*/
+
+ public boolean build(InterfaceContract interfaceContract, BuilderContext context){
+ return getBuilder().build(interfaceContract, context);
+ }
+
+ private synchronized ContractBuilder getBuilder() {
+ if (builder == null) {
+ try {
+ Class<?> builderClass = sd.loadClass();
+ try {
+ Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
+ builder = (ContractBuilder)constructor.newInstance(registry);
+ } catch (NoSuchMethodException e) {
+ Constructor<?> constructor = builderClass.getConstructor();
+ builder = (ContractBuilder)constructor.newInstance();
+
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder;
+ }
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java
new file mode 100644
index 0000000000..d47c3d9032
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java
@@ -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.sca.assembly.builder;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * A builder that handles any build-time configuration needed by implementations.
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface ImplementationBuilder<I extends Implementation> {
+
+ /**
+ * Configure a component implementation.
+ *
+ * @param component The component
+ * @param context TODO
+ * @param contract The implementation
+ */
+ void build(Component component, I implmentation, BuilderContext context);
+
+ /**
+ * Get the QName of the implementation type
+ * @return
+ */
+ QName getImplementationType();
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java
new file mode 100644
index 0000000000..4f2842c61a
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java
@@ -0,0 +1,31 @@
+/*
+ * 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.sca.assembly.builder;
+
+/**
+ * Constants for resource bundle names
+ */
+public interface Messages {
+ String RESOURCE_PACKAGE = "org.apache.tuscany.sca.assembly.builder.";
+ String ASSEMBLY_VALIDATION = RESOURCE_PACKAGE + "assembly-validation-messages";
+ String ASSEMBLY_CONFORMANCE = RESOURCE_PACKAGE + "assembly-conformance-messages";
+ String DEFINITIONS_VALIDATION = RESOURCE_PACKAGE + "definitions-validation-messages";
+ String BUILDER_VALIDATION_BUNDLE = "org.apache.tuscany.sca.builder.builder-validation-messages";
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java
new file mode 100644
index 0000000000..423c856973
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java
@@ -0,0 +1,84 @@
+/*
+ * 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.sca.assembly.builder;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * A builder that is contributed by a specific policy language to validate the configurations
+ * for SCA endpoints, endpoint references and component implementations
+ * @tuscany.spi.extension.inheritfrom
+ */
+public interface PolicyBuilder<T> {
+ /**
+ * Get the policy type
+ * @return
+ */
+ QName getPolicyType();
+
+ /**
+ * Return the list of binding type QNames at which this policy implementation
+ * is targeted. Or null if the policy is not binding specific
+ * @return list of binding type QNames at which this policy implementation or null if it's not binding specific
+ */
+ List<QName> getSupportedBindings();
+
+ /**
+ * Build (and validate) the policy settings on the endpoint
+ * @param endpoint
+ * @param monitor
+ * @return true if the policy setting is compatible
+ */
+ boolean build(Endpoint endpoint, BuilderContext context);
+
+ /**
+ * Build (and validate) the policy settings on the endpoint reference
+ * @param endpointReference
+ * @param monitor
+ * @return true if the policy setting is compatible
+ */
+ boolean build(EndpointReference endpointReference, BuilderContext context);
+
+ /**
+ * Build (and validate) the policy settings on the component implementation
+ * @param component
+ * @param implementation
+ * @param monitor
+ * @return true if the policy setting is compatible
+ */
+ boolean build(Component component, Implementation implementation, BuilderContext context);
+
+ /**
+ * Build (and validate) the policy settings on the endpoint reference is compatible with the endpoint
+ * @param endpointReference
+ * @param endpoint
+ * @param context
+ * @return if the policy setting is compatible
+ */
+ boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context);
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java
new file mode 100644
index 0000000000..2bfbe85664
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sca.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+
+/**
+ * A builder that connects an endpoint reference to an endpoint
+ */
+public interface WireBuilder {
+ /**
+ * Build the endpoint reference against the endpoint. If the endpoint is a valid target for the
+ * endpoint reference, the wire buidler can populate some information from the endpoint into the
+ * endpoint reference (such as targetEndpoint, policySets or requiredIntents)
+ * @param endpointReference
+ * @param endpoint
+ * @param context
+ * @return true if the endpoint is a valid target for the endpoint reference
+ */
+ boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context);
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
new file mode 100644
index 0000000000..24dc20f815
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
@@ -0,0 +1,112 @@
+/*
+ * 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.sca.assembly.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * Represents an abstract property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyImpl extends ExtensibleImpl implements AbstractProperty {
+ protected Object value;
+ protected String name;
+ protected QName xsdType;
+ protected QName xsdElement;
+ protected boolean many;
+ protected boolean mustSupply;
+ protected DataType dataType;
+ protected Object xsdDefinition;
+
+ /**
+ * Constructs a new abstract property.
+ */
+ protected AbstractPropertyImpl() {
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public QName getXSDElement() {
+ return xsdElement;
+ }
+
+ public QName getXSDType() {
+ return xsdType;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public boolean isMustSupply() {
+ return mustSupply;
+ }
+
+ public void setValue(Object defaultValue) {
+ this.value = defaultValue;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ public void setMustSupply(boolean mustSupply) {
+ this.mustSupply = mustSupply;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setXSDElement(QName element) {
+ this.xsdElement = element;
+ }
+
+ public void setXSDType(QName type) {
+ this.xsdType = type;
+ }
+
+ public DataType getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(DataType dataType) {
+ this.dataType = dataType;
+ }
+
+ public Object getXSDDefinition() {
+ return xsdDefinition;
+ }
+
+ public void setXSDDefinition(Object xsdDefinition) {
+ this.xsdDefinition = xsdDefinition;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
new file mode 100644
index 0000000000..3e44f5f7ae
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+
+/**
+ * Represents an abstract reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractReferenceImpl extends ContractImpl implements AbstractReference {
+ private Multiplicity multiplicity = Multiplicity.ONE_ONE;
+
+ /**
+ * Constructs a new abstract reference.
+ */
+ protected AbstractReferenceImpl() {
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(Multiplicity multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
new file mode 100644
index 0000000000..24b1a0e03e
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
@@ -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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractService;
+
+/**
+ * Represents an abstract service
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractServiceImpl extends ContractImpl implements AbstractService {
+
+ /**
+ * Constructs a new abstract service.
+ */
+ protected AbstractServiceImpl() {
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
new file mode 100644
index 0000000000..0759ff1361
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
@@ -0,0 +1,138 @@
+/*
+ * 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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Extension;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
+/**
+ * A factory for the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AssemblyFactoryImpl implements AssemblyFactory {
+
+ protected ExtensionPointRegistry registry;
+
+ protected AssemblyFactoryImpl(ExtensionPointRegistry registry) {
+ super();
+ this.registry = registry;
+ }
+
+ 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 Property createProperty() {
+ return new PropertyImpl();
+ }
+
+ public Reference createReference() {
+ return new ReferenceImpl();
+ }
+
+ public Service createService() {
+ return new ServiceImpl();
+ }
+
+ public Wire createWire() {
+ return new WireImpl();
+ }
+
+ public Extension createExtension() {
+ return new ExtensionImpl();
+ }
+
+ public Endpoint createEndpoint() {
+ return new EndpointImpl(registry);
+ }
+
+ public EndpointReference createEndpointReference() {
+ return new EndpointReferenceImpl(registry);
+ }
+
+ public ConfiguredOperation createConfiguredOperation() {
+ return new ConfiguredOperationImpl();
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
new file mode 100644
index 0000000000..516b11724f
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
@@ -0,0 +1,45 @@
+/*
+ * 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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+/**
+ * Convenience base class for assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseImpl implements Base {
+ private boolean unresolved;
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected BaseImpl() {
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java
new file mode 100644
index 0000000000..ae9581cb6d
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java
@@ -0,0 +1,124 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.OperationSelector;
+import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Base Binding implementation class
+ */
+public abstract class BindingImpl extends ExtensibleImpl implements Binding {
+ protected QName type;
+
+ private String name;
+ private String uri;
+ private ExtensionType extensionType;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+
+ protected BindingImpl(QName type) {
+ super();
+ this.type = type;
+ }
+
+ public QName getType() {
+ return type;
+ }
+
+ 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;
+ }
+
+ public ExtensionType getExtensionType() {
+ return extensionType;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ this.extensionType = type;
+ }
+
+ public OperationSelector getOperationSelector() {
+ return null;
+ }
+
+ public WireFormat getRequestWireFormat() {
+ return null;
+ }
+
+ public WireFormat getResponseWireFormat() {
+ return null;
+ }
+
+ public void setOperationSelector(OperationSelector operationSelector) {
+ }
+
+ public void setRequestWireFormat(WireFormat wireFormat) {
+ }
+
+ public void setResponseWireFormat(WireFormat wireFormat) {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getType()).append(" (");
+ buf.append("uri=").append(getURI());
+ buf.append(",name=").append(getName());
+ buf.append(")");
+ return buf.toString();
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
new file mode 100644
index 0000000000..dec68d1413
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
@@ -0,0 +1,77 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackImpl extends ExtensibleImpl implements Callback {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private Contract parentContract;
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ protected CallbackImpl() {
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public ExtensionType getExtensionType() {
+ return null;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public Contract getParentContract() {
+ return parentContract;
+ }
+
+ public void setParentContract(Contract contract) {
+ this.parentContract = contract;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
new file mode 100644
index 0000000000..8a03df339c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
@@ -0,0 +1,186 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentImpl extends ExtensibleImpl implements Component, Cloneable {
+ private Implementation implementation;
+ private String name;
+ private String uri;
+ private List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
+ private List<ComponentReference> references = new ArrayList<ComponentReference>();
+ private List<ComponentService> services = new ArrayList<ComponentService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private Boolean autowire;
+ private ExtensionType type;
+
+ /**
+ * Constructs a new component.
+ */
+ protected ComponentImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ComponentImpl clone = (ComponentImpl)super.clone();
+
+ clone.properties = new ArrayList<ComponentProperty>();
+ for (ComponentProperty property : getProperties()) {
+ clone.properties.add((ComponentProperty)property.clone());
+ }
+ clone.references = new ArrayList<ComponentReference>();
+ for (ComponentReference reference : getReferences()) {
+ clone.references.add((ComponentReference)reference.clone());
+ }
+ clone.services = new ArrayList<ComponentService>();
+ for (ComponentService service : getServices()) {
+ clone.services.add((ComponentService)service.clone());
+ }
+
+ // Clone the implementation.composite
+ if(implementation instanceof Composite) {
+ clone.implementation = (Composite) ((Composite) implementation).clone();
+ }
+
+ // Clone the Lists for intents and policySets
+ clone.requiredIntents = new ArrayList<Intent>(getRequiredIntents());
+ clone.policySets = new ArrayList<PolicySet>(getPolicySets());
+
+ return clone;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Implementation getImplementation() {
+ return implementation;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<ComponentProperty> getProperties() {
+ return properties;
+ }
+
+ public ComponentProperty getProperty(String name) {
+ for (ComponentProperty property : getProperties()) {
+ if (property.getName().equals(name)) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ public List<ComponentReference> getReferences() {
+ return references;
+ }
+
+ public ComponentReference getReference(String name){
+ for (ComponentReference ref : getReferences()){
+ if (ref.getName().equals(name)){
+ return ref;
+ }
+ }
+ return null;
+ }
+
+ public List<ComponentService> getServices() {
+ return services;
+ }
+
+ public ComponentService getService(String name) {
+ for (ComponentService service : getServices()) {
+ if (service.getName().equals(name)) {
+ return service;
+ }
+ }
+ return null;
+ }
+
+ public void setImplementation(Implementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public ExtensionType getExtensionType() {
+ return type;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ this.type = type;
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer("Component (");
+ buf.append("uri=").append(uri);
+ buf.append(",name=").append(name);
+ buf.append(",implementation=").append(implementation);
+ buf.append(")");
+ return buf.toString();
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
new file mode 100644
index 0000000000..9db522930f
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
@@ -0,0 +1,97 @@
+/*
+ * 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.sca.assembly.impl;
+
+import javax.xml.xpath.XPathExpression;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+
+/**
+ * Represents a component property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty, Cloneable {
+ private String file;
+ private Property property;
+ private String source;
+ private XPathExpression sourceXPathExpression;
+
+ /**
+ * Constructs a new component property.
+ */
+ protected ComponentPropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ // FIXME getValue should not delegate to property.getValue()
+ // Doing this violates the setValue/getValue semantics, as you
+ // can call setValue() then get a different value from getValue()
+ @Override
+ public Object getValue() {
+ if (super.getValue() == null && property != null) {
+ return property.getValue();
+ } else {
+ return super.getValue();
+ }
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public Property getProperty() {
+ return property;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public void setProperty(Property property) {
+ this.property = property;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public XPathExpression getSourceXPathExpression() {
+ return sourceXPathExpression;
+ }
+
+ public void setSourceXPathExpression(XPathExpression sourceXPathExpression) {
+ this.sourceXPathExpression = sourceXPathExpression;
+ }
+
+ public String toString() {
+ return "Property: " + getName() + " Value: " + getValue();
+ } // end method toString
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
new file mode 100644
index 0000000000..78b54668b3
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
@@ -0,0 +1,119 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents a component reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable {
+ private Reference reference;
+ private Boolean autowire;
+ private boolean nonOverridable;
+ private List<CompositeReference> promotedAs = new ArrayList<CompositeReference>();
+ private ComponentService callbackService;
+ private boolean isPromoted = false;
+
+ /**
+ * Constructs a new component reference.
+ */
+ protected ComponentReferenceImpl() {
+ // Set multiplicity to null so that by default it'll inherit from the Reference
+ setMultiplicity(null);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Reference getReference() {
+ return reference;
+ }
+
+ public void setReference(Reference reference) {
+ this.reference = reference;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public List<CompositeReference> promotedAs() {
+ return promotedAs;
+ }
+
+ public ComponentService getCallbackService() {
+ return callbackService;
+ }
+
+ public void setCallbackService(ComponentService callbackService) {
+ this.callbackService = callbackService;
+ }
+
+ /**
+ * Use endpoint information to work out what the interface contract for the
+ * binding is.
+ */
+ @Override
+ public InterfaceContract getInterfaceContract(Binding binding) {
+ InterfaceContract interfaceContract = null;
+
+ if (interfaceContract == null) {
+ interfaceContract = getInterfaceContract();
+ }
+ return interfaceContract;
+ }
+
+ public boolean isNonOverridable() {
+ return nonOverridable;
+ }
+
+ public void setNonOverridable(boolean nonOverridable) {
+ this.nonOverridable = nonOverridable;
+ }
+
+ public void setPromoted(boolean isPromoted) {
+ this.isPromoted = isPromoted;
+ } // end method setPromoted
+
+ public boolean isPromoted() {
+ return isPromoted;
+ }
+} // end class ComponentReferenceImpl
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
new file mode 100644
index 0000000000..f8c9f53413
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
@@ -0,0 +1,71 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * Represents a component service
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentServiceImpl extends ServiceImpl implements ComponentService, Cloneable {
+ private Service service;
+ private List<CompositeService> promotedAs = new ArrayList<CompositeService>();
+ private ComponentReference callbackReference;
+
+ /**
+ * Constructs a new component service.
+ */
+ protected ComponentServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public List<CompositeService> promotedAs() {
+ return promotedAs;
+ }
+
+ public ComponentReference getCallbackReference() {
+ return callbackReference;
+ }
+
+ public void setCallbackReference(ComponentReference callbackReference) {
+ this.callbackReference = callbackReference;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
new file mode 100644
index 0000000000..b52c65ef8b
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
@@ -0,0 +1,176 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a component type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType, Cloneable {
+ private String uri;
+ private List<Property> properties = new ArrayList<Property>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Service> services = new ArrayList<Service>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new component type.
+ */
+ protected ComponentTypeImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ComponentTypeImpl clone = (ComponentTypeImpl)super.clone();
+
+ clone.services = new ArrayList<Service>();
+ for (Service service : getServices()) {
+ clone.services.add((Service)service.clone());
+ }
+ clone.references = new ArrayList<Reference>();
+ for (Reference reference : getReferences()) {
+ clone.references.add((Reference)reference.clone());
+ }
+ clone.properties = new ArrayList<Property>();
+ for (Property property : getProperties()) {
+ clone.properties.add((Property)property.clone());
+ }
+ clone.requiredIntents = new ArrayList<Intent>(requiredIntents);
+ clone.policySets = new ArrayList<PolicySet>(policySets);
+ return clone;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public Property getProperty(String name){
+ Property property = null;
+
+ for (Property tmp : getProperties()){
+ if (tmp.getName().equals(name)){
+ property = tmp;
+ break;
+ }
+ }
+
+ return property;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public Reference getReference(String name){
+ Reference reference = null;
+
+ for (Reference tmp : getReferences()){
+ if (tmp.getName().equals(name)){
+ reference = tmp;
+ break;
+ }
+ }
+
+ return reference;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public Service getService(String name){
+ Service service = null;
+
+ for (Service tmp : getServices()){
+ if (tmp.getName().equals(name)){
+ service = tmp;
+ break;
+ }
+ }
+
+ return service;
+ }
+
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public ExtensionType getExtensionType() {
+ return null;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uri == null) ? 0 : uri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ComponentTypeImpl other = (ComponentTypeImpl)obj;
+ if (uri == null) {
+ if (other.uri != null) {
+ return false;
+ }
+ } else if (!uri.equals(other.uri)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
new file mode 100644
index 0000000000..99b443133f
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
@@ -0,0 +1,200 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+
+/**
+ * Implementation of a Composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeImpl extends ImplementationImpl implements Composite, Cloneable {
+ private String specVersion = "undefined";
+ private String contributionURI;
+ private List<Component> components = new ArrayList<Component>();
+ private List<Composite> includes = new ArrayList<Composite>();
+ private List<Composite> fusedIncludes = new ArrayList<Composite>();
+ private QName name;
+ private List<Wire> wires = new ArrayList<Wire>();
+ private Boolean autowire;
+ private boolean local = true;
+
+ /**
+ * Constructs a new composite.
+ */
+ protected CompositeImpl() {
+ super(TYPE);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ CompositeImpl clone = (CompositeImpl)super.clone();
+
+ // clone the child components
+ clone.components = new ArrayList<Component>();
+ for (Component component : getComponents()) {
+ Component clonedComponent = (Component)component.clone();
+ clone.components.add(clonedComponent);
+ }
+
+ // reset the references and services so they get re-resolved
+ for (Service service : clone.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ // Force the promoted component/service to be rebuilt against the clone
+ if (compositeService.getPromotedComponent() != null) {
+ compositeService.getPromotedComponent().setUnresolved(true);
+ }
+ if (compositeService.getPromotedService() != null) {
+ compositeService.getPromotedService().setUnresolved(true);
+ }
+ }
+ for (Reference reference : clone.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ for (ComponentReference ref : compositeReference.getPromotedReferences()) {
+ // Force the promoted reference to be rebuilt against the clone
+ ref.setUnresolved(true);
+ }
+ }
+
+ // clone the wires
+ clone.wires = new ArrayList<Wire>();
+ for (Wire wire : getWires()) {
+ clone.wires.add((Wire)wire.clone());
+ }
+
+ // Clone the includes
+ clone.includes = new ArrayList<Composite>();
+ for (Composite included : getIncludes()) {
+ clone.includes.add((Composite)included.clone());
+ }
+ return clone;
+ }
+
+ public String getSpecVersion() {
+ return specVersion;
+ }
+
+ public void setSpecVersion(String specVersion) {
+ this.specVersion = specVersion;
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ public Component getComponent(String name) {
+ Component component = null;
+
+ for (Component tmp : getComponents()){
+ if (tmp.getName().equals(name)){
+ component = tmp;
+ break;
+ }
+ }
+ return component;
+ }
+
+ public List<Composite> getIncludes() {
+ return includes;
+ }
+ public List<Composite> getFusedIncludes() {
+ return fusedIncludes;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public List<Wire> getWires() {
+ return wires;
+ }
+
+ public boolean isLocal() {
+ return local;
+ }
+
+ public void setLocal(boolean local) {
+ this.local = local;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof Composite) {
+ if (getName() != null) {
+ return getName().equals(((Composite)obj).getName());
+ } else {
+ return ((Composite)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Composite (name=" + getName() + ")";
+ }
+
+ @Override
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ @Override
+ public void setContributionURI(String contributionURI) {
+ this.contributionURI = contributionURI;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
new file mode 100644
index 0000000000..ae5fad461b
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+
+/**
+ * Represents a composite reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference, Cloneable {
+ private List<Component> promotedComponents = new ArrayList<Component>();
+ private List<ComponentReference> promotedReferences = new ArrayList<ComponentReference>();
+
+ /**
+ * Constructs a new composite reference.
+ */
+ protected CompositeReferenceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ CompositeReferenceImpl copy = (CompositeReferenceImpl)super.clone();
+ copy.promotedComponents = new ArrayList<Component>(promotedComponents);
+ copy.promotedReferences = new ArrayList<ComponentReference>(promotedReferences);
+ return copy;
+ }
+
+ public List<ComponentReference> getPromotedReferences() {
+ return promotedReferences;
+ }
+
+ public List<Component> getPromotedComponents() {
+ return promotedComponents;
+ }
+
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
new file mode 100644
index 0000000000..55b48ec578
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
@@ -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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+
+/**
+ * Represents a composite service
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServiceImpl extends ServiceImpl implements CompositeService, Cloneable {
+ private ComponentService promotedService;
+ private Component promotedComponent;
+
+ /**
+ * Constructs a new composite service.
+ */
+ protected CompositeServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public ComponentService getPromotedService() {
+ return promotedService;
+ }
+
+ public void setPromotedService(ComponentService promotedService) {
+ this.promotedService = promotedService;
+ }
+
+ public Component getPromotedComponent() {
+ return promotedComponent;
+ }
+
+ public void setPromotedComponent(Component promotedComponent) {
+ this.promotedComponent = promotedComponent;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
new file mode 100644
index 0000000000..80c1c7cd21
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
@@ -0,0 +1,95 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents an Operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOperation {
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ private String name;
+ private String contractName;
+ private ExtensionType type;
+
+ /**
+ * Constructs a new Operation.
+ */
+ protected ConfiguredOperationImpl() {
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public String getContractName() {
+ return contractName;
+ }
+
+ public void setContractName(String contractName) {
+ this.contractName = contractName;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public ExtensionType getExtensionType() {
+ return type;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ this.type = type;
+ }
+
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
new file mode 100644
index 0000000000..2b72f1f047
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
@@ -0,0 +1,88 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Implementation of a Contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContractImpl extends ExtensibleImpl implements AbstractContract {
+ private InterfaceContract interfaceContract;
+ private String name;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+ private boolean isCallback = false;
+
+ /**
+ * Constructs a new contract.
+ */
+ protected ContractImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public InterfaceContract getInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isForCallback() {
+ return isCallback;
+ }
+
+ public void setForCallback(boolean isCallback) {
+ this.isCallback = isCallback;
+ }
+
+ public ExtensionType getExtensionType() {
+ return null;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
new file mode 100644
index 0000000000..195fa4303e
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
@@ -0,0 +1,321 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
+import org.apache.tuscany.sca.assembly.builder.ContractBuilder;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * The assembly model object for an endpoint.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EndpointImpl implements Endpoint {
+ private static final long serialVersionUID = 7344399683703812593L;
+
+ protected transient ExtensionPointRegistry registry;
+ protected transient BuilderExtensionPoint builders;
+ protected transient ContractBuilder contractBuilder;
+ protected boolean unresolved;
+ protected String uri;
+ protected String deployedURI;
+ protected Component component;
+ protected ComponentService service;
+ protected Binding binding;
+ protected InterfaceContract interfaceContract;
+ protected List<EndpointReference> callbackEndpointReferences = new ArrayList<EndpointReference>();
+ protected List<PolicySet> policySets = new ArrayList<PolicySet>();
+ protected List<Intent> requiredIntents = new ArrayList<Intent>();
+ protected boolean remote = false;
+ protected String specVersion = Base.SCA11_NS;
+
+ protected EndpointImpl(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public Component getComponent() {
+ resolve();
+ return component;
+ }
+
+ public void setComponent(Component component) {
+ this.component = component;
+ reset();
+ }
+
+ public ComponentService getService() {
+ resolve();
+ return service;
+ }
+
+ public void setService(ComponentService service) {
+ this.service = service;
+ reset();
+ }
+
+ public Binding getBinding() {
+ resolve();
+ return binding;
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ reset();
+ }
+
+ public InterfaceContract getComponentServiceInterfaceContract() {
+ resolve();
+ if (interfaceContract == null && service != null) {
+ interfaceContract = service.getInterfaceContract();
+ }
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+
+ /**
+ * Get the services callbacl enpoint references that
+ * represent endpoint references from which callbacks
+ * originate
+ *
+ * @return callbackEndpoint the reference callback endpoint
+ */
+ public List<EndpointReference> getCallbackEndpointReferences() {
+ resolve();
+ return callbackEndpointReferences;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ resolve();
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ resolve();
+ return requiredIntents;
+ }
+
+ public ExtensionType getExtensionType() {
+ getBinding();
+ if (binding instanceof PolicySubject) {
+ return ((PolicySubject)binding).getExtensionType();
+ }
+ return null;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String toStringWithoutHash() {
+ String output = "Endpoint: ";
+
+ if (getURI() != null) {
+ output += " URI = " + getURI();
+ }
+
+ if (unresolved) {
+ output += " [Unresolved]";
+ }
+
+ return output;
+ }
+
+ public String toString() {
+ return "(@" + this.hashCode() + ")" + toStringWithoutHash();
+ }
+
+ public String getURI() {
+ if (uri == null) {
+ if (component != null && service != null && binding != null) {
+ String bindingName = binding.getName();
+ if (bindingName == null) {
+ bindingName = service.getName();
+ }
+ uri = component.getURI() + "#service-binding(" + service.getName() + "/" + bindingName + ")";
+ } else if (component != null && service != null) {
+ uri = component.getURI() + "#service(" + service.getName() + ")";
+ } else if (component != null) {
+ uri = component.getURI();
+ }
+ }
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ protected void resolve() {
+ }
+
+ protected void reset() {
+ this.uri = null;
+ }
+
+ protected void setExtensionPointRegistry(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ public boolean isRemote() {
+ return remote;
+ }
+
+ public void setRemote(boolean remote) {
+ this.remote = remote;
+ }
+
+ public boolean matches(String serviceURI) {
+ String[] parts1 = parseServiceURI(serviceURI);
+ String[] parts2 = parseStructuralURI(getURI());
+ for (int i = 0; i < parts1.length; i++) {
+ if (parts1[i] == null || parts1[i].equals(parts2[i])) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Parse the service URI into an array of names. The service URI is in one of the following formats:
+ * <ul>
+ * <li>componentName
+ * <li>componentName/serviceName
+ * <li>componentName/serviceName/bindingName
+ * </ul>
+ * @param serviceURI
+ * @return
+ */
+ private static String[] parseServiceURI(String serviceURI) {
+ if (serviceURI.startsWith("/")) {
+ serviceURI = serviceURI.substring(1);
+ }
+ if (serviceURI.contains("#")) {
+ return parseStructuralURI(serviceURI);
+ }
+ String[] names = new String[3];
+ String[] segments = serviceURI.split("/");
+ for (int i = 0; i < names.length && i < segments.length; i++) {
+ names[i] = segments[i];
+ }
+ return names;
+ }
+
+ /**
+ * Parse the structural URI into an array of parts (componentURI, serviceName, bindingName)
+ * @param structuralURI
+ * @return [0]: componentURI [1]: serviceName [2]: bindingName
+ */
+ private static String[] parseStructuralURI(String structuralURI) {
+ String[] names = new String[3];
+ int index = structuralURI.lastIndexOf('#');
+ if (index == -1) {
+ names[0] = structuralURI;
+ } else {
+ names[0] = structuralURI.substring(0, index);
+ String str = structuralURI.substring(index + 1);
+ if (str.startsWith("service-binding(") && str.endsWith(")")) {
+ str = str.substring("service-binding(".length(), str.length() - 1);
+ String[] parts = str.split("/");
+ if (parts.length != 2) {
+ throw new IllegalArgumentException("Invalid service-binding URI: " + structuralURI);
+ }
+ names[1] = parts[0];
+ names[2] = parts[1];
+ } else if (str.startsWith("service(") && str.endsWith(")")) {
+ str = str.substring("service(".length(), str.length() - 1);
+ // [rfeng] Deal with empty service name
+ if (!"".equals(str)) {
+ names[1] = str;
+ }
+ } else {
+ throw new IllegalArgumentException("Invalid structural URI: " + structuralURI);
+ }
+ }
+ return names;
+ }
+
+ public boolean isAsyncInvocation() {
+ if (service != null && service.getName().endsWith("_asyncCallback")) {
+ // this is a response service at the reference component so don't create a
+ // response reference.
+ return false;
+ } // end if
+
+ for (Intent intent : getRequiredIntents()) {
+ if (intent.getName().getLocalPart().equals("asyncInvocation")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getDeployedURI() {
+ return deployedURI == null ? (binding == null ? null : binding.getURI()) : deployedURI;
+ }
+
+ @Override
+ public void setDeployedURI(String deployedURI) {
+ this.deployedURI = deployedURI;
+ }
+
+ @Override
+ public String getSpecVersion() {
+ return specVersion;
+ }
+
+ @Override
+ public void setSpecVersion(String specVersion){
+ this.specVersion = specVersion;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
new file mode 100644
index 0000000000..ac0c7c93a8
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
@@ -0,0 +1,289 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
+import org.apache.tuscany.sca.assembly.builder.ContractBuilder;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * The assembly model object for an endpoint.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EndpointReferenceImpl implements EndpointReference {
+ private static final long serialVersionUID = 8838066441709300972L;
+
+ protected transient ExtensionPointRegistry registry;
+ protected transient BuilderExtensionPoint builders;
+ protected transient ContractBuilder contractBuilder;
+ protected boolean unresolved = true;
+ protected String uri;
+ protected String deployedURI;
+ protected Component component;
+ protected ComponentReference reference;
+ protected Binding binding;
+ protected List<PolicySet> policySets = new ArrayList<PolicySet>();
+ protected List<Intent> requiredIntents = new ArrayList<Intent>();
+ protected InterfaceContract interfaceContract;
+ protected Status status = Status.NOT_CONFIGURED;
+
+ // the target of the endpoint reference
+ protected Endpoint targetEndpoint;
+
+ // callback endpoint that messages across this reference
+ // will be directed toward
+ protected Endpoint callbackEndpoint;
+
+ protected EndpointReferenceImpl(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ EndpointReference cloned = (EndpointReference)super.clone();
+
+ if (targetEndpoint != null) {
+ cloned.setTargetEndpoint((Endpoint)targetEndpoint.clone());
+ }
+
+ return cloned;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public Component getComponent() {
+ resolve();
+ return component;
+ }
+
+ public void setComponent(Component component) {
+ this.component = component;
+ reset();
+ }
+
+ public ComponentReference getReference() {
+ resolve();
+ return reference;
+ }
+
+ public void setReference(ComponentReference reference) {
+ this.reference = reference;
+ reset();
+ }
+
+ public Binding getBinding() {
+ resolve();
+ return binding;
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ reset();
+ }
+
+ public Endpoint getTargetEndpoint() {
+ resolve();
+ return targetEndpoint;
+ }
+
+ public void setTargetEndpoint(Endpoint targetEndpoint) {
+ this.targetEndpoint = targetEndpoint;
+ reset();
+ }
+
+ public InterfaceContract getComponentReferenceInterfaceContract() {
+ resolve();
+ if (interfaceContract == null && reference != null) {
+ interfaceContract = reference.getInterfaceContract();
+ }
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ reset();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ resolve();
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ resolve();
+ return requiredIntents;
+ }
+
+ public ExtensionType getExtensionType() {
+ getBinding();
+ if (binding instanceof PolicySubject) {
+ return ((PolicySubject)binding).getExtensionType();
+ }
+ return null;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Endpoint getCallbackEndpoint() {
+ resolve();
+ return callbackEndpoint;
+ }
+
+ public void setCallbackEndpoint(Endpoint callbackEndpoint) {
+ this.callbackEndpoint = callbackEndpoint;
+ reset();
+ }
+
+ public String toStringWithoutHash() {
+ StringBuffer output = new StringBuffer("EndpointReference: ");
+
+ if (getURI() != null) {
+ output.append(" URI = ").append(getURI());
+ }
+
+ output.append(" ").append(status);
+
+ if (targetEndpoint != null) {
+ output.append(" Target = ").append(targetEndpoint);
+ }
+
+ return output.toString();
+ }
+
+ public String toString() {
+ return "(@" + this.hashCode() + ")" + toStringWithoutHash();
+ }
+
+ public String getURI() {
+ if (uri == null) {
+ if (component != null && reference != null && binding != null) {
+ String bindingName = binding.getName();
+ if (bindingName == null) {
+ bindingName = reference.getName();
+ }
+ uri = component.getURI() + "#reference-binding(" + reference.getName() + "/" + bindingName + ")";
+ } else if (component != null && reference != null) {
+ uri = component.getURI() + "#reference(" + reference.getName() + ")";
+ } else if (component != null) {
+ uri = component.getURI();
+ }
+ }
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ protected void resolve() {
+ }
+
+ protected void reset() {
+ this.uri = null;
+ }
+
+ public void setExtensionPointRegistry(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ @Override
+ public String getDeployedURI() {
+ String targetURI = deployedURI;
+ if (targetURI != null) {
+ return targetURI;
+ }
+ if (getTargetEndpoint() != null) {
+ targetURI = getTargetEndpoint().getDeployedURI();
+ }
+ if (targetURI != null) {
+ return targetURI;
+ }
+ if (binding != null) {
+ targetURI = binding.getURI();
+ }
+ return targetURI;
+ }
+
+ @Override
+ public void setDeployedURI(String deployedURI) {
+ this.deployedURI = deployedURI;
+ }
+
+ /**
+ * Indicates whether this EndpointReference is connected to a target service which is asynchronous.
+ * This can be marked in one of 3 ways:
+ * - the EndpointReference has the "asyncInvocation" intent set
+ * - the EndpointReference has a name ending with "_asyncCallback"
+ * - there is a target Endpoint configured that itself is marked as async invocation
+ * @return - true if the service is asynchronous invocation, false otherwise
+ */
+ public boolean isAsyncInvocation() {
+ if (reference != null && reference.getName().endsWith("_asyncCallback")){
+ // this is a response reference at the service component so don't create a
+ // response service. The response service will be at the reference component
+ return false;
+ } // end if
+
+ // Check if the EndpointReference is explicitly marked with the asyncInvocation intent
+ for(Intent intent : getRequiredIntents()){
+ if (intent.getName().getLocalPart().equals("asyncInvocation")){
+ return true;
+ } // end if
+ } // end for
+
+ // Check if the target Endpoint is marked as asyncInvocation
+ if( targetEndpoint != null ) {
+ if (targetEndpoint.isAsyncInvocation()) {
+ return true;
+ } // end if
+ } // end if
+ return false;
+ } // end method isAsyncInvocation
+
+} // end class EndpointReferenceImpl
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
new file mode 100644
index 0000000000..340fa2854c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Extension;
+
+/**
+ * Convenience base class for extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ExtensibleImpl extends BaseImpl implements Extensible {
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Extension> attributeExtensions = new ArrayList<Extension>();
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected ExtensibleImpl() {
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public List<Extension> getAttributeExtensions() {
+ return attributeExtensions;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java
new file mode 100644
index 0000000000..e69eb4a771
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java
@@ -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.sca.assembly.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Extension;
+
+public class ExtensionImpl implements Extension {
+ private QName qName;
+ private Object value;
+ private boolean isAttribute = false;
+
+ public ExtensionImpl() {
+ }
+
+ public ExtensionImpl(QName qName, Object value, boolean isAttribute) {
+ this.qName = qName;
+ this.value = value;
+ this.isAttribute = isAttribute;
+ }
+
+ public QName getQName() {
+ return qName;
+ }
+
+ public void setQName(QName qName) {
+ this.qName = qName;
+ }
+
+ public <T> T getValue() {
+ return (T)value;
+ }
+
+ public <T> void setValue(T value) {
+ this.value = value;
+ }
+
+ public boolean isAttribute() {
+ return isAttribute;
+ }
+
+ public void setAttribute(boolean isAttribute) {
+ this.isAttribute = isAttribute;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
new file mode 100644
index 0000000000..f943438a9f
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
@@ -0,0 +1,89 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Base implementation class of Implementation model interface
+ *
+ * @version $Rev$ $Date$
+ * @tuscany.spi.extension.inheritfrom
+ */
+public abstract class ImplementationImpl extends ComponentTypeImpl implements Implementation, PolicySubject {
+ protected QName type;
+ protected ExtensionType extensionType;
+ protected List<Operation> operations = new ArrayList<Operation>();
+
+ protected ImplementationImpl(QName type) {
+ super();
+ this.type = type;
+ }
+
+ public ExtensionType getExtensionType() {
+ return extensionType;
+ }
+
+ public void setExtensionType(ExtensionType extensionType) {
+ this.extensionType = extensionType;
+ }
+
+ public QName getType() {
+ return type;
+ }
+
+ public String toString() {
+ return String.valueOf(getType());
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ImplementationImpl impl = (ImplementationImpl)super.clone();
+ impl.operations = new ArrayList<Operation>();
+ for (Operation operation : operations) {
+ impl.operations.add((Operation)operation.clone());
+ }
+ return impl;
+ }
+
+ // Override the ComponentTypeImpl.hashCode()
+ @Override
+ public int hashCode() {
+ return System.identityHashCode(this);
+ }
+
+ // Override the ComponentTypeImpl.equals()
+ @Override
+ public boolean equals(Object obj) {
+ return this == obj;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
new file mode 100644
index 0000000000..263af296b1
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
@@ -0,0 +1,59 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PropertyImpl extends AbstractPropertyImpl implements Property, Cloneable {
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new property.
+ */
+ protected PropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
new file mode 100644
index 0000000000..6e5e09adf6
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
@@ -0,0 +1,156 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceImpl extends AbstractReferenceImpl implements Reference, Cloneable {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private boolean wiredByImpl;
+ private List<ComponentService> targets = new ArrayList<ComponentService>();
+ private Callback callback;
+ private boolean overridingBindings;
+ private boolean allowsPassByReference;
+ private List<EndpointReference> endpointReferences = new ArrayList<EndpointReference>();
+
+ /**
+ * Constructs a new reference.
+ */
+ protected ReferenceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ReferenceImpl clone = (ReferenceImpl)super.clone();
+ clone.bindings = new ArrayList<Binding>();
+ for (Binding binding : getBindings()){
+ clone.bindings.add((Binding)binding.clone());
+ }
+ clone.targets = new ArrayList<ComponentService>(targets);
+ // clone the endpoint references themselves and set the reference pointer back to
+ // this new refrence
+ clone.endpointReferences = new ArrayList<EndpointReference>();
+
+ for (EndpointReference epr : endpointReferences) {
+ EndpointReference eprClone = (EndpointReference)epr.clone();
+ eprClone.setReference((ComponentReference)clone);
+ clone.endpointReferences.add(eprClone);
+ }
+ return clone;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public Binding getBinding(String name) {
+ for (Binding binding : bindings) {
+ if (binding.getName().equals(name)) {
+ return binding;
+ }
+ }
+ return null;
+ }
+
+ public <B> B getBinding(Class<B> bindingClass) {
+ for (Binding binding : bindings) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ return null;
+ }
+
+ public <B> B getCallbackBinding(Class<B> bindingClass) {
+ if (callback != null) {
+ for (Binding binding : callback.getBindings()) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isWiredByImpl() {
+ return wiredByImpl;
+ }
+
+ public void setWiredByImpl(boolean wiredByImpl) {
+ this.wiredByImpl = wiredByImpl;
+ }
+
+ public List<ComponentService> getTargets() {
+ return targets;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+ /**
+ * By default return the interface contract for the reference
+ */
+ public InterfaceContract getInterfaceContract(Binding binding) {
+ return getInterfaceContract();
+ }
+
+ public List<EndpointReference> getEndpointReferences() {
+ return endpointReferences;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ public boolean isOverridingBindings() {
+ return overridingBindings;
+ }
+
+ public void setOverridingBindings(boolean overridingBindings) {
+ this.overridingBindings = overridingBindings;
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java
new file mode 100644
index 0000000000..84e5825b50
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+
+/**
+ * A factory for the SCA binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingFactoryImpl implements SCABindingFactory {
+
+ public SCABindingFactoryImpl() {
+
+ }
+
+ public SCABinding createSCABinding() {
+ return new SCABindingImpl();
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
new file mode 100644
index 0000000000..bad560ab04
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
@@ -0,0 +1,169 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Extension;
+import org.apache.tuscany.sca.assembly.OperationSelector;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * The assembly mode object for an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingImpl implements SCABinding, Extensible, PolicySubject {
+ private String name;
+ private String uri;
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Extension> attributeExtensions = new ArrayList<Extension>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private ExtensionType extensionType;
+ private WireFormat wireFormat;
+ private String delegateBindingType;
+ private String delegateBindingURI;
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected SCABindingImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Getters for the binding URI. The computed URI for the
+ * service that the reference is targeting or which the service represents
+ * depending on whether the biding is associated with a reference or
+ * service
+ *
+ * @return the binding URI
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public List<Extension> getAttributeExtensions() {
+ return attributeExtensions;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public ExtensionType getExtensionType() {
+ return extensionType;
+ }
+
+ public void setExtensionType(ExtensionType intentAttachPointType) {
+ this.extensionType = intentAttachPointType;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public QName getType() {
+ return TYPE;
+ }
+
+ public WireFormat getRequestWireFormat() {
+ return wireFormat;
+ }
+
+ public void setRequestWireFormat(WireFormat wireFormat) {
+ this.wireFormat = wireFormat;
+ }
+
+ public WireFormat getResponseWireFormat() {
+ return wireFormat;
+ }
+
+ public void setResponseWireFormat(WireFormat wireFormat) {
+ this.wireFormat = wireFormat;
+ }
+
+ public OperationSelector getOperationSelector() {
+ return null;
+ }
+
+ public void setOperationSelector(OperationSelector operationSelector) {
+ }
+
+ public String getDelegateBindingType() {
+ return delegateBindingType;
+ }
+
+ public void setDelegateBindingType(String delegateBindingType) {
+ this.delegateBindingType = delegateBindingType;
+ }
+
+ public String getDelegateBindingURI() {
+ return delegateBindingURI;
+ }
+
+ public void setDelegateBindingURI(String delegateBindingURI) {
+ this.delegateBindingURI = delegateBindingURI;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
new file mode 100644
index 0000000000..4a8fd70910
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
@@ -0,0 +1,126 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneable {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private boolean overridingBindings;
+ private Callback callback;
+ private List<Endpoint> endpoints = new ArrayList<Endpoint>();
+ private boolean isJAXWSService = false;
+
+ /**
+ * Constructs a new service.
+ */
+ protected ServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ServiceImpl clone = (ServiceImpl)super.clone();
+ clone.bindings = new ArrayList<Binding>();
+ for (Binding binding : getBindings()){
+ clone.bindings.add((Binding)binding.clone());
+ }
+ return clone;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public Binding getBinding(String name) {
+ for (Binding binding : bindings) {
+ if (binding.getName().equals(name)) {
+ return binding;
+ }
+ }
+ return null;
+ }
+
+ public <B> B getBinding(Class<B> bindingClass) {
+ for (Binding binding : bindings) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ return null;
+ }
+
+ public <B> B getCallbackBinding(Class<B> bindingClass) {
+ if (callback != null) {
+ for (Binding binding : callback.getBindings()) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ }
+ return null;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+ /**
+ * By default return the interface contract for the service
+ */
+ public InterfaceContract getInterfaceContract(Binding binding) {
+ return getInterfaceContract();
+ }
+
+ public List<Endpoint> getEndpoints() {
+ return endpoints;
+ }
+
+ public boolean isOverridingBindings() {
+ return overridingBindings;
+ }
+
+ public void setOverridingBindings(boolean overridingBindings) {
+ this.overridingBindings = overridingBindings;
+ }
+
+ public boolean isJAXWSService() {
+ return isJAXWSService;
+ }
+
+ public void setJAXWSService(boolean isJAXWSService) {
+ this.isJAXWSService = isJAXWSService;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
new file mode 100644
index 0000000000..a4990f6a98
--- /dev/null
+++ b/sca-java-2.x/branches/2.0/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
@@ -0,0 +1,105 @@
+/*
+ * 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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireImpl extends ExtensibleImpl implements Wire, Cloneable {
+ private ComponentReference source;
+ private ComponentService target;
+ private boolean replace;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new wire.
+ */
+ protected WireImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ 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;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public ExtensionType getExtensionType() {
+ return null;
+ }
+
+ public void setExtensionType(ExtensionType type) {
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public boolean isReplace() {
+ return replace;
+ }
+
+ public void setReplace(boolean replace) {
+ this.replace = replace;
+ }
+}