summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/java-M1/java/sca/model/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches/java-M1/java/sca/model/src/main')
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java42
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java64
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java260
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java46
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java45
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java32
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java25
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java28
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java40
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java81
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java66
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java94
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java35
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java63
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java74
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java44
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java25
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java34
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java67
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java37
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java59
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java40
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java62
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java40
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java24
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java25
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java46
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java39
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java49
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java47
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java91
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java34
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java36
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java31
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java24
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java60
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java58
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java38
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java48
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java88
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java217
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java123
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java29
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java62
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java213
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java147
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java357
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java106
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java102
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java53
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java116
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java75
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java116
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java72
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java82
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java41
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java35
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java104
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java61
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java82
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java80
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java41
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java60
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java29
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java210
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java51
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java51
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java38
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java42
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java71
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java34
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java89
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java51
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java234
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java108
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java212
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt1277
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE18
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd36
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd37
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd239
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd37
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd38
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd69
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd33
-rw-r--r--sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties25
89 files changed, 7639 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java
new file mode 100644
index 0000000000..e167882786
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.tuscany.model;
+
+import org.apache.tuscany.common.TuscanyRuntimeException;
+
+/**
+ * The root runtime exception for the model.
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings({"serial"})
+public abstract class ModelRuntimeException extends TuscanyRuntimeException {
+
+ public ModelRuntimeException() {
+ super();
+ }
+
+ public ModelRuntimeException(String message) {
+ super(message);
+ }
+
+ public ModelRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ModelRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java
new file mode 100644
index 0000000000..48aed5f35a
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * Context object supplied by visitors that are processing the model.
+ */
+public interface AssemblyContext {
+
+ /**
+ * Returns a factory that can be used to create other model objects
+ *
+ * @return a factory for model objects
+ */
+ AssemblyFactory getAssemblyFactory();
+
+ /**
+ * Returns a loader for resources in the application environment.
+ *
+ * @return a loader for resources in the system environment
+ */
+ ResourceLoader getApplicationResourceLoader();
+
+ /**
+ * Returns a loader that can be used to load sub-models.
+ *
+ * @return a loader for sub-models
+ */
+ AssemblyModelLoader getAssemblyLoader();
+
+ /**
+ * Returns an SDO type helper.
+ *
+ * @return an SDO type helper
+ */
+ TypeHelper getTypeHelper();
+
+ /**
+ * Returns the Web application module URI
+ *
+ * @return the module name of the Web app
+ */
+ String getWebAppName();
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java
new file mode 100644
index 0000000000..efbc6bffa4
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java
@@ -0,0 +1,260 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.model.types.java.JavaServiceContract;
+import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
+
+/**
+ * The Factory for the assembly model. Provides a create method for each non-abstract class of the model.
+ */
+public interface AssemblyFactory {
+
+ /**
+ * Returns a new SimpleComponent.
+ *
+ * @return a new SimpleComponent
+ */
+ AtomicComponent createSimpleComponent();
+
+ /**
+ * Returns a new ComponentType.
+ *
+ * @return a new ComponentType
+ */
+ ComponentType createComponentType();
+
+ /**
+ * Returns a new EntryPoint.
+ *
+ * @return a new EntryPoint
+ */
+ EntryPoint createEntryPoint();
+
+ /**
+ * Returns a new ExternalService.
+ *
+ * @return a new ExternalService
+ */
+ ExternalService createExternalService();
+
+ /**
+ * Returns a new JavaServiceContract.
+ *
+ * @return a new JavaServiceContract
+ */
+ JavaServiceContract createJavaServiceContract();
+
+ /**
+ * Returns a new Module.
+ *
+ * @return a new Module
+ */
+ Module createModule();
+
+ /**
+ * Returns a new ModuleComponent.
+ *
+ * @return a new ModuleComponent
+ */
+ ModuleComponent createModuleComponent();
+
+ /**
+ * Returns a new ModuleFragment.
+ *
+ * @return a new ModuleFragment
+ */
+ ModuleFragment createModuleFragment();
+
+ /**
+ * Returns a new Reference.
+ *
+ * @return a new Reference
+ */
+ Reference createReference();
+
+ /**
+ * Returns a new ConfiguredReference.
+ *
+ * @return a new ConfiguredReference
+ */
+ ConfiguredReference createConfiguredReference();
+
+ /**
+ * Returns a new Service.
+ *
+ * @return a new Service
+ */
+ Service createService();
+
+ /**
+ * Returns a new ConfiguredService.
+ *
+ * @return a new ConfiguredService
+ */
+ ConfiguredService createConfiguredService();
+
+ /**
+ * Returns a new Subsystem.
+ *
+ * @return a new Subsystem
+ */
+ Subsystem createSubsystem();
+
+ /**
+ * Returns a new Property.
+ *
+ * @return a new Property
+ */
+ Property createProperty();
+
+ /**
+ * Returns a new ConfiguredProperty.
+ *
+ * @return a new ConfiguredProperty
+ */
+ ConfiguredProperty createConfiguredProperty();
+
+ /**
+ * Returns a new WSDLServiceContract.
+ *
+ * @return a new WSDLServiceContract
+ */
+ WSDLServiceContract createWSDLServiceContract();
+
+ /**
+ * Create a new ServiceURI from the given uri string.
+ *
+ * @param uri the URI for the service
+ * @return a new ServiceURI created from the supplied URI
+ */
+ ServiceURI createServiceURI(String uri);
+
+ /**
+ * Creates a new ServiceURI from a module component and a service name.
+ *
+ * @param moduleComponent the module component exposing the service
+ * @param serviceName the name of the service exposed by the module
+ * @return a new ServiceURI for the exposed service
+ */
+ ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName);
+
+ /**
+ * Creates a new ServiceURI from a module component and configured port.
+ *
+ * @param moduleComponent the module component exposing the service
+ * @param part the part that is providing the service
+ * @param configuredPort the port on the part
+ * @return a new serviceURI for the exposed service
+ */
+ ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort);
+
+ ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName);
+
+ /**
+ * Create a qname from a URI
+ *
+ * @param uri
+ * @return a new qname
+ */
+ QName createQName(String uri);
+
+ /**
+ * Create a wire
+ *
+ * @return an new wire
+ */
+ Wire createWire();
+
+ /**
+ * Helper method for creating a reference.
+ *
+ * @param name the name of the reference
+ * @param service the Java type of the service
+ * @return a Reference
+ */
+ Reference createReference(String name, Class<?> service);
+
+ /**
+ * Helper method for creating a reference.
+ *
+ * @param name the name of the reference
+ * @param service the Java type of the service
+ * @param multiplicity the multiplicity of the reference
+ * @return a Reference
+ */
+ Reference createReference(String name, Class<?> service, Multiplicity multiplicity);
+
+ /**
+ * Helper method for creating a configured reference.
+ *
+ * @param name the name of the reference
+ * @param targets the targets for the reference
+ * @return a ConfiguredReference
+ */
+ ConfiguredReference createConfiguredReference(String name, String... targets);
+
+ /**
+ * Helper method for creating an EntryPoint wired to a single target.
+ *
+ * @param entryPointName the name of the entry point
+ * @param serviceContract the service contract the EntryPoint should expose
+ * @param binding the binding the EntryPoint should use
+ * @param targetName the target the EntryPoint exposes
+ * @return an EntryPoint that exposes the supplied service and is wired to the target
+ */
+ EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName);
+
+ /**
+ * Helper method for creating an EntryPoint wired to a single target.
+ *
+ * @param entryPointName the name of the entry point
+ * @param configuredService the configured service to expose
+ * @param binding the binding the EntryPoint should use
+ * @param configuredReference a configured reference to the target
+ * @return an EntryPoint that exposes the supplied service using the supplied bindng and which is wired
+ * using the supplied reference
+ */
+ EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference);
+
+ /**
+ * Helper method for creating a simple Property.
+ *
+ * @param name the property name
+ * @param type the Java type of the property
+ * @return a Property with the supplied name and type
+ */
+ Property createProperty(String name, Class<?> type);
+
+ /**
+ * Returns a new ImportWSDL model object.
+ *
+ * @return a new ImportWSDL model object
+ */
+ ImportWSDL createImportWSDL();
+
+ /**
+ * Returns a new ImportWSDL model object initialized with the supplied values.
+ *
+ * @param location the location where the WSDL definition can be found
+ * @param namespace the namespace URI for this import
+ * @return a new ImportWSDL model object
+ */
+ ImportWSDL createImportWSDL(String location, String namespace);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java
new file mode 100644
index 0000000000..69a7854df9
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java
@@ -0,0 +1,46 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import org.apache.tuscany.model.ModelRuntimeException;
+
+/**
+ * Denotes an exception initializing an assembly model artifact.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AssemblyInitializationException extends ModelRuntimeException {
+ private static final long serialVersionUID = 747289653378365323L;
+
+ public AssemblyInitializationException() {
+ super();
+ }
+
+ public AssemblyInitializationException(String message) {
+ super(message);
+ }
+
+ public AssemblyInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AssemblyInitializationException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java
new file mode 100644
index 0000000000..d25f114902
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Base interface for all assembly model objects providing methods for managing the model itself.
+ */
+public interface AssemblyObject {
+
+ /**
+ * Initialize this model object.
+ *
+ * @param modelContext context providing access to the environment in which this model is being used
+ * @throws AssemblyInitializationException if an error ocurrs initializing the artifact
+ */
+ void initialize(AssemblyContext modelContext) throws AssemblyInitializationException;
+
+ /**
+ * Freeze this model object preventing any additional changes.
+ */
+ void freeze();
+
+ /**
+ * Accept a visitor
+ *
+ * @param visitor a visitor that is visiting the model
+ * @return true if processing is complete and the visitor should stop traversing the model
+ */
+ boolean accept(AssemblyVisitor visitor);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java
new file mode 100644
index 0000000000..f153b9b4f6
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java
@@ -0,0 +1,32 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * A visitor that traverses the model performing some operation.
+ */
+public interface AssemblyVisitor {
+
+ /**
+ * Visit the given model object.
+ *
+ * @param modelObject the assembly model object to visit
+ * @return true if processing is complete
+ */
+ boolean visit(AssemblyObject modelObject);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java
new file mode 100644
index 0000000000..0c98bbbe95
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * An atomic component, specifically not an {@link Composite}.
+ */
+public interface AtomicComponent extends Component<AtomicImplementation> {
+}
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java
new file mode 100644
index 0000000000..4d0703186b
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * The implementation for a specific atomic component instance.
+ * This interface will typically be extended by component type implementations to indicate the
+ * specific implementation to be used by a runtime and to allow for additional runtime configuration
+ * properties.
+ */
+public interface AtomicImplementation extends Implementation {
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java
new file mode 100644
index 0000000000..51becc29c2
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * The binding of an entry point or external service to a transport.
+ * This model object will typically be extended by binding implementations to allow
+ * specification of binding/transport specific information.
+ */
+public interface Binding extends AssemblyObject {
+ /**
+ * Returns the binding URI.
+ * @return the binding uri
+ * TODO do we need this?
+ */
+ String getURI();
+
+ /**
+ * Sets binding URI.
+ * @param value the binding uri
+ * TODO do we need this?
+ */
+ void setURI(String value);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java
new file mode 100644
index 0000000000..b8d566f1d6
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java
@@ -0,0 +1,81 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+
+/**
+ * A component is a configured instance of a generic {@link Implementation}.
+ */
+public interface Component<I extends Implementation> extends Part {
+
+ /**
+ * Returns the Implementation for this configured instance.
+ * @return the Implementation for this configured instance
+ */
+ I getImplementation();
+
+ /**
+ * Sets the Implementation for this configured instance
+ * @param value the Implementation for this configured instance
+ */
+ void setImplementation(I value);
+
+ /**
+ * Returns a list of configured property values for this configured instance.
+ * These values will be used to initialize the component when it is activated.
+ * @return a list of ConfiguredProperty values
+ */
+ List<ConfiguredProperty> getConfiguredProperties();
+
+ /**
+ * Returns the ConfiguredProperty value for the specified property.
+ *
+ * @param name the name of the Property
+ * @return the configured property value for the named property
+ */
+ ConfiguredProperty getConfiguredProperty(String name);
+
+ /**
+ * Returns the configured references for the configured instance.
+ *
+ * @return the configured references for the configured instance
+ */
+ List<ConfiguredReference> getConfiguredReferences();
+
+ /**
+ * Returns the ConfiguredReference value for the specified reference.
+ * @param name the name of the Property
+ * @return the configured reference value for the named reference
+ */
+ ConfiguredReference getConfiguredReference(String name);
+
+ /**
+ * Returns the configured services for the configured instance.
+ * @return the configured services for the configured instance
+ */
+ List<ConfiguredService> getConfiguredServices();
+
+ /**
+ * Returns the ConfiguredService value for the specified property.
+ * @param name the name of the Property
+ * @return the configured service value for the named service
+ */
+ ConfiguredService getConfiguredService(String name);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java
new file mode 100644
index 0000000000..58ac9bc9de
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java
@@ -0,0 +1,66 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+
+/**
+ * A logical definition of a type of component separate from any specific implementation.
+ */
+public interface ComponentType extends Extensible {
+
+ /**
+ * Returns a list of services exposed by this component type.
+ * @return a list of services exposed by this component type
+ */
+ List<Service> getServices();
+
+ /**
+ * Returns the specfied service if exposed by this component type.
+ * @param name the name of the service
+ * @return the service identified by the supplied name, or null if there is no service with that name
+ */
+ Service getService(String name);
+
+ /**
+ * Returns the list of references this component type consumes.
+ * @return the list of references this component type consumes
+ */
+ List<Reference> getReferences();
+
+ /**
+ * Returns the specified reference.
+ * @param name the name of the reference
+ * @return the reference identified by the supplied name, or null if there is no reference with that name
+ */
+ Reference getReference(String name);
+
+ /**
+ * Returns the list of properties that can be used to configure components with this component type.
+ * @return the list of properties that can be used to configure components with this component type
+ */
+ List<Property> getProperties();
+
+ /**
+ * Returns the specified property
+ * @param name the name of the property
+ * @return the property with the supplied name, or null if there is no property with that name
+ */
+ Property getProperty(String name);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java
new file mode 100644
index 0000000000..09f51945bb
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java
@@ -0,0 +1,94 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+/**
+ * A model object that describes a container for parts.
+ */
+public interface Composite extends Implementation {
+
+ /**
+ * Returns the name of the composite.
+ * @return the name of the composite
+ */
+ String getName();
+
+ /**
+ * Sets the name of the composite.
+ * @param name the name of the composite
+ */
+ void setName(String name);
+
+ /**
+ * Returns the named part.
+ * @param name
+ */
+ Part getPart(String name);
+
+ /**
+ * Returns all entry points contained in this composite.
+ * @return a list of all EntryPoint model objects contained in this composite
+ */
+ List<EntryPoint> getEntryPoints();
+
+ /**
+ * Returns all components contained in this composite.
+ * @return a list of all Component model objects contained in this composite
+ */
+ List<Component> getComponents();
+
+ /**
+ * Returns all external services contained in this composite.
+ * @return a list of all ExternalService model objects contained in this composite
+ */
+ List<ExternalService> getExternalServices();
+
+ /**
+ * Returns the wires contained in this composite.
+ */
+ List<Wire> getWires();
+
+ /**
+ * Returns the WSDL imports declared in this composite.
+ */
+ List<ImportWSDL> getWSDLImports();
+
+ /**
+ * Returns the WSDL imports for the given namespace.
+ * @param namespace
+ */
+ List<ImportWSDL> getWSDLImports(String namespace);
+
+ /**
+ * Returns the configured service at the given address.
+ * @param address
+ */
+ ConfiguredService getConfiguredService(ServiceURI address);
+
+ /**
+ * Returns the implementation class.
+ */
+ Class<?> getImplementationClass();
+
+ /**
+ * Sets the implementation class.
+ */
+ void setImplementationClass(Class<?> value);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java
new file mode 100644
index 0000000000..c78fe28ff5
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Specialization of Component that represents a configured {@link Module}.
+ */
+public interface CompositeComponent<I extends Composite> extends Component<I> {
+
+ /**
+ * Returns the uri that uniquely identifies this module component.
+ * @return the uri that uniquely identifies this module component
+ */
+ String getURI();
+
+ /**
+ * Sets the uri that uniquely identifies this module component.
+ * @param uri the uri that uniquely identifies this module component
+ */
+ void setURI(String uri);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java
new file mode 100644
index 0000000000..7f562e99d9
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java
@@ -0,0 +1,63 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * Represents a configured port (e.g. a configured reference or configured service).
+ */
+public interface ConfiguredPort<P extends Port> extends AssemblyObject, ProxyFactoryHolder {
+
+ /**
+ * Returns the name of the port being configured.
+ *
+ * @return the name of the port being configured
+ */
+ String getName();
+
+ /**
+ * Set the name of the port being configured.
+ *
+ * @param name the name of the port being configured
+ */
+ void setName(String name);
+
+ /**
+ * Returns the port that is being configured.
+ * @return the port that is being configured
+ */
+ P getPort();
+
+ /**
+ * Sets the port that is being configured.
+ * @param port the port that is being configured
+ */
+ void setPort(P port);
+
+ /**
+ * Returns the part containing this port.
+ * @return the part that contains this port
+ */
+ Part getPart();
+
+ /**
+ * Sets the configured part containing this port.
+ * @param part the configured part containing this port.
+ */
+ void setPart(Part part);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java
new file mode 100644
index 0000000000..0d3a3e5011
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * The configured value of a {@link Property}.
+ */
+public interface ConfiguredProperty extends AssemblyObject {
+
+ //FIXME remove the name attribute?
+ /**
+ * Returns the name of the property being configured.
+ * @return the name of the property being configured
+ */
+ String getName();
+
+ /**
+ * Set the name of the property being configured.
+ * @param name the name of the property being configured
+ */
+ void setName(String name);
+
+ /**
+ * Returns the {@link Property} whose value is being set.
+ * @return the {@link Property} whose value is being set
+ */
+ Property getProperty();
+
+ /**
+ * Sets the {@link Property} whose value is being set.
+ * @param property the {@link Property} whose value is being set
+ */
+ void setProperty(Property property);
+
+ /**
+ * Returns the value being set for this usage of the {@link Property}.
+ * @return the value being set for this usage of the {@link Property}
+ */
+ Object getValue();
+
+ /**
+ * Sets the value being set for this usage of the {@link Property}.
+ * @param value the value being set for this usage of the {@link Property}
+ */
+ void setValue(Object value);
+
+ /**
+ * Returns the override option that determines if any configuration for this property
+ * that is contained in this composite can be overridden by configuration supplied from outside.
+ */
+ OverrideOption getOverrideOption();
+
+ /**
+ * Set the override option that determines if any configuration for this property
+ * that is contained in this composite can be overridden by configuration supplied from outside.
+ *
+ * @param value the option that determines how property configuration can be overriden
+ */
+ void setOverrideOption(OverrideOption value);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java
new file mode 100644
index 0000000000..22cb734869
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+/**
+ * A configured reference associated with a particular usage.
+ * Each configuredReference represents a configured version of an logical
+ * reference defined in the ComponentType. If the logical reference
+ * has a multiplicity greater than 1 (0..n or 1..n) then the configured
+ * reference many have multiple targets.
+ */
+public interface ConfiguredReference extends ConfiguredPort<Reference> {
+
+ /**
+ * List of URIs for the targets of this reference.
+ *
+ * @return the list of URIs for the targets of this reference
+ */
+ List<String> getTargets();
+
+ /**
+ * Returns the list of configured services that are wired to this configured reference.
+ *
+ * @return the list of configured services that are wired to this configured reference
+ */
+ List<ConfiguredService> getTargetConfiguredServices();
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java
new file mode 100644
index 0000000000..696250ea44
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * A configured service associated with a particular usage.
+ */
+public interface ConfiguredService extends ConfiguredPort<Service> {
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java
new file mode 100644
index 0000000000..20259f245d
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * A model object that can hold a runtime context factory object.
+ */
+public interface ContextFactoryHolder {
+
+ /**
+ * Sets the context factory
+ */
+ void setContextFactory(Object contextFactory);
+
+ /**
+ * Returns the context factory
+ */
+ Object getContextFactory();
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java
new file mode 100644
index 0000000000..a90b89c4f5
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java
@@ -0,0 +1,67 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+
+/**
+ * An entry point exposed by its containing {@link Composite}.
+ * References from outside the composite can only be connected to its entry points.
+ */
+public interface EntryPoint extends Part {
+
+ /**
+ * Returns the bindings supported by this entry point.
+ * A single entry point may be bound to multiple transports.
+ *
+ * @return a list of bindings supported by this entry point
+ */
+ List<Binding> getBindings();
+
+ /**
+ * Returns the configured service exposed by this entry point.
+ *
+ * @return the configured service exposed by this entry point
+ */
+ ConfiguredService getConfiguredService();
+
+ /**
+ * Sets the configured service exposed by this entry point.
+ *
+ * @param configuredService the configured service exposed by this entry point
+ */
+ void setConfiguredService(ConfiguredService configuredService);
+
+ /**
+ * Returns the configured reference that wires this entry point to the published service
+ * inside the composite.
+ *
+ * @return the reference that wires this entry point to the published service
+ */
+ ConfiguredReference getConfiguredReference();
+
+ /**
+ * Sets the configured reference that wires this entry point to the published service
+ * inside the composite.
+ *
+ * @param configuredReference the configured reference that wires this entry point to
+ * the published service inside the composite
+ */
+ void setConfiguredReference(ConfiguredReference configuredReference);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java
new file mode 100644
index 0000000000..b4651a6186
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+/**
+ * An extensible model object. We actually need this even though we have the ability to load specializations
+ * of individual model objects
+ */
+public interface Extensible extends AssemblyObject {
+
+ /**
+ * Returns the extensibility elements.
+ */
+ List<Object> getExtensibilityElements();
+
+ /**
+ * Returns the extensibility attributes.
+ */
+ List<Object> getExtensibilityAttributes();
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java
new file mode 100644
index 0000000000..f2b72ec928
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+
+/**
+ * An external service consumed by its containing {@link Composite}.
+ * All references used by the composite are specified as external services.
+ */
+public interface ExternalService extends Part {
+
+ /**
+ * Returns the bindings that can be used by operations on this external service.
+ * A single external service may be bound to multiple transports.
+ */
+ List<Binding> getBindings();
+
+ /**
+ * Returns the override option that determines if any wiring for this external service
+ * that is contained in this composite can be overridden by wired supplied from outside.
+ */
+ OverrideOption getOverrideOption();
+
+ /**
+ * Set the override option that determines if any wiring for this external service
+ * that is contained in this composite can be overridden by wired supplied from outside.
+ *
+ * @param value the option that determines how wires can be overriden
+ */
+ void setOverrideOption(OverrideOption value);
+
+ /**
+ * Returns the configured service that this external service provides to other parts of the containing composite.
+ * @return the configured service that this external service provides to other parts of the containing composite
+ */
+ ConfiguredService getConfiguredService();
+
+ /**
+ * Sets the configured service that this external service provides to other parts of the containing composite
+ * @param configuredService the configured service that this external service provides to other parts of the containing composite
+ */
+ void setConfiguredService(ConfiguredService configuredService);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java
new file mode 100644
index 0000000000..2777d985f8
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * The implementation for a specific component instance.
+ * This interface will typically be extended by component type implementations to indicate the
+ * specific implementation to be used by a runtime and to allow for additional runtime configuration
+ * properties.
+ */
+public interface Implementation extends Extensible {
+
+ /**
+ * Returns the generic component type corresponding to this implementation.
+ * @return the generic component type corresponding to this implementation
+ */
+ ComponentType getComponentType();
+
+ /**
+ * Sets the generic component type corresponding to this implementation.
+ * @param componentType the generic component type corresponding to this implementation
+ */
+ void setComponentType(ComponentType componentType);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
new file mode 100644
index 0000000000..7c858a1b76
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import javax.wsdl.Definition;
+
+/**
+ * Model object that represents the import of an external WSDL definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImportWSDL extends AssemblyObject {
+ /**
+ * Returns the location where the WSDL definition can be found.
+ * @return the location where the WSDL definition can be found
+ */
+ String getLocation();
+
+ /**
+ * Set the location where the WSDL definition can be found.
+ * @param uri the location where the WSDL definition can be found
+ */
+ void setLocation(String uri);
+
+ /**
+ * Returns the namespace URI for this import.
+ * @return the namespace URI for this import
+ */
+ String getNamespace();
+
+ /**
+ * Sets the namespace URI for this import.
+ * @param uri the namespace URI for this import
+ */
+ void setNamespace(String uri);
+
+ /**
+ * Returns the WSDL Definition.
+ * @return the WSDL Definition
+ */
+ Definition getDefinition();
+
+ /**
+ * Sets the WSDL Definition.
+ * @param definition the WSDL Definition
+ */
+ void setDefinition(Definition definition);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java
new file mode 100644
index 0000000000..40d1d1534b
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import java.util.List;
+
+/**
+ * A specialized {@link Implementation} that defines a modular unit of assembly.
+ * A Module denotes the extent of assembly in which pass-by-reference semantics are supported.
+ */
+public interface Module extends Composite {
+
+ /**
+ * Returns a list of assembly fragments that combine to form a single module.
+ * @return a list of assembly fragments that combine to form a single module
+ */
+ List<ModuleFragment> getModuleFragments();
+
+ /**
+ * Returns the specified assembly fragment.
+ * @param name the name of the fragment
+ * @return the fragment with the specified name, or null if there is no fragment with that name
+ */
+ ModuleFragment getModuleFragment(String name);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java
new file mode 100644
index 0000000000..00f6079096
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Specialization of Component that represents a configured {@link Module}.
+ */
+public interface ModuleComponent extends CompositeComponent<Module> {
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java
new file mode 100644
index 0000000000..dec1e8bfd3
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * A fragment of assembly configuration within a module.
+ * To support flexibility and reuse, modules can be defined in multiple fragments that are
+ * then combined by the runtime to form the complete module definition.
+ */
+public interface ModuleFragment extends Composite {
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java
new file mode 100644
index 0000000000..c51ab7b8ea
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java
@@ -0,0 +1,46 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Enumeration for multiplicity.
+ */
+public enum Multiplicity {
+ /**
+ * Indicates a relationship that is optionally connected to the requestor and which, if supplied,
+ * must be connected to exactly one provider.
+ */
+ ZERO_ONE,
+
+ /**
+ * Indicates a relationship that must be connected between exactly one requestor and
+ * exactly one provider.
+ */
+ ONE_ONE,
+
+ /**
+ * Indicates a relationship that is optionally connects the requestor to zero to unbounded providers.
+ */
+ ZERO_N,
+
+ /**
+ * Indicates a relationship that must be connected at the requestor and which connects it to
+ * zero to unbounded providers.
+ */
+ ONE_N
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java
new file mode 100644
index 0000000000..68489d0200
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Enumeration for override options that are used to control whether configuration information
+ * can be overridden by larger grained definitions.
+ */
+public enum OverrideOption {
+ /**
+ * Indicates that the supplied configuration cannot be overridden.
+ */
+ NO,
+
+ /**
+ * Indicates that the supplied configuration may be overriden.
+ */
+ MAY,
+
+ /**
+ * Indicates that the supplied configuration must be overriden.
+ */
+ MUST
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java
new file mode 100644
index 0000000000..9645ad6d35
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+
+/**
+ * A configured object that is contained inside a {@link Composite}.
+ */
+public interface Part extends Extensible, ContextFactoryHolder {
+ /**
+ * Returns the name that uniquely identifies this component within its containing composite.
+ * @return the name that uniquely identifies this component within its containing composite
+ */
+ String getName();
+
+ /**
+ * Sets the name that uniquely identifies this component within its containing composite.
+ * @param value the name that uniquely identifies this component within its containing composite
+ */
+ void setName(String value);
+
+ /**
+ * Returns the composite that contains this component.
+ * @return the composite that contains this component
+ */
+ Composite getComposite();
+
+ /**
+ * Sets the composite that contains this component.
+ * @param the composite that contains this component
+ */
+ void setComposite(Composite composite);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java
new file mode 100644
index 0000000000..13b9d0a1db
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java
@@ -0,0 +1,47 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Abstraction for the association of a service contract with a requestor or provider.
+ */
+public interface Port extends AssemblyObject {
+ /**
+ * Returns the contract for invocations of a service using this port.
+ * @return the oontract for invocations of a service using this port
+ */
+ ServiceContract getServiceContract();
+
+ /**
+ * Set the contract for invocations of a service using this port.
+ * @param contract the contract for invocations of a service using this port
+ */
+ void setServiceContract(ServiceContract contract);
+
+ /**
+ * Returns the name of the port where it is associated with a requestor or provider.
+ * @return the name of the port
+ */
+ String getName();
+
+ /**
+ * Sets the name of the port where it is associated with a requestor or provider.
+ * @param name the name of the port where it is associated with a requestor or provider
+ */
+ void setName(String name);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java
new file mode 100644
index 0000000000..1f238efce6
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+
+/**
+ * A description of a property that can be used to configure a component.
+ */
+public interface Property extends Extensible {
+ // todo should we decalre this as Property<T> where T would be the type of this Property?
+
+ /**
+ * 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 ths property
+ */
+ Object getDefaultValue();
+
+ /**
+ * Sets the default value of the property.
+ * @param value the default value of ths property
+ */
+ void setDefaultValue(Object value);
+
+ /**
+ * 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 value true if the property should allow multiple values
+ */
+ void setMany(boolean value);
+
+ /**
+ * Returns true if a value must be supplied for the property.
+ * @return true is a value must be supplied for the property
+ */
+ boolean isRequired();
+
+ /**
+ * Sets whether a value must be supplied for the property.
+ * For ease of use, it is recommended that a meaningful default value should
+ * be supplied for all properties; users should only be required to specify
+ * a value if there is no reasonable default.
+ *
+ * @param value set to true to require that a value be supplied for uses of this property
+ */
+ void setRequired(boolean value);
+
+ /**
+ * Returns the type of this property as used by the runtime.
+ * @return the type of this property as used by the runtime
+ */
+ Class<?> getType();
+
+ /**
+ * Sets the type of this property as used by the runtime
+ * @param value the type of this property as used by the runtime
+ */
+ void setType(Class<?> value);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java
new file mode 100644
index 0000000000..055448b2f5
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * A model object that can hold a runtime proxy factory object.
+ */
+public interface ProxyFactoryHolder {
+
+ /**
+ * Sets the proxy factory
+ */
+ void setProxyFactory(Object proxyFactory);
+
+ /**
+ * Returns the proxy factory
+ */
+ Object getProxyFactory();
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java
new file mode 100644
index 0000000000..8cc13e98ec
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java
@@ -0,0 +1,36 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * The association of a port with a requestor.
+ */
+public interface Reference extends Port {
+ /**
+ * 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-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java
new file mode 100644
index 0000000000..c7194292f0
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * The types of scope supported by assemblies.
+ */
+public enum Scope {
+ // todo define what these are
+ INSTANCE,
+ REQUEST,
+ SESSION,
+ MODULE,
+ AGGREGATE,
+ UNDEFINED
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java
new file mode 100644
index 0000000000..c73002efba
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * The association of a port with a provider.
+ */
+public interface Service extends Port {
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java
new file mode 100644
index 0000000000..1600e11663
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java
@@ -0,0 +1,60 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * The contract specified by a requestor or provider for invocations across a port.
+ */
+public interface ServiceContract extends Extensible {
+
+ /**
+ * Returns the interface for invocations from the requestor to the provider.
+ * @return the interface for invocations from the requestor to the provider
+ */
+ Class getInterface();
+
+ /**
+ * Sets the interface for invocations from the requestor to the provider.
+ * @param value the interface for invocations from the requestor to the provider
+ */
+ void setInterface(Class value);
+
+ /**
+ * Returns the callback interface for wire from the provider back to its requestor.
+ * @return the callback interface for wire from the provider back to its requestor
+ */
+ Class getCallbackInterface();
+
+ /**
+ * Sets the callback interface for wire from the provider back to its requestor.
+ * @param value the callback interface for wire from the provider back to its requestor
+ */
+ void setCallbackInterface(Class value);
+
+ /**
+ * Returns the scope of this service contract.
+ * @return
+ */
+ Scope getScope();
+
+ /**
+ * Sets the scope.
+ * @param scope of this service contract.
+ */
+ void setScope(Scope scope);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java
new file mode 100644
index 0000000000..740febc360
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java
@@ -0,0 +1,58 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Represents a service URI.
+ */
+public interface ServiceURI {
+
+ /**
+ * Returns true if the address scheme is sca
+ * @return
+ */
+ public boolean isSCAScheme();
+
+ /**
+ * @return Returns the address.
+ */
+ public String getAddress();
+
+ /**
+ * @return Returns the path.
+ */
+ public String getPath();
+
+ /**
+ * Returns the module component name
+ * @return
+ */
+ public String getModuleComponentName();
+
+ /**
+ * Returns the part name
+ * @return
+ */
+ public String getPartName();
+
+ /**
+ * Returns the service name
+ * @return
+ */
+ public String getServiceName();
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java
new file mode 100644
index 0000000000..709ba4da35
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+
+/**
+ * Represents a subsystem.
+ */
+public interface Subsystem extends Composite {
+
+ /**
+ * Returns the subsystem uri.
+ * @return
+ */
+ String getURI();
+
+ /**
+ * Sets the subsystem uri.
+ * @param value
+ */
+ void setURI(String value);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java
new file mode 100644
index 0000000000..dfe553210a
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * A connection between a requestor (source) and a provider (target).
+ */
+public interface Wire extends Extensible {
+ /**
+ * Returns the URI for the source of the request.
+ * @return the URI for the source of the request
+ */
+ ServiceURI getSource();
+
+ /**
+ * Sets the URI for the source of the request.
+ * @param uri the URI for the source of the request
+ */
+ void setSource(ServiceURI uri);
+
+ /**
+ * Returns the URI for the target of the request.
+ * @return the URI for the target of the request
+ */
+ ServiceURI getTarget();
+
+ /**
+ * Sets the URI for the target of the request.
+ * @param uri the URI for the target of the request
+ */
+ void setTarget(ServiceURI uri);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java
new file mode 100644
index 0000000000..a7f9012db7
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java
@@ -0,0 +1,88 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ */
+public class AssemblyContextImpl implements AssemblyContext {
+
+ private final AssemblyFactory assemblyFactory;
+ private final AssemblyModelLoader assemblyLoader;
+ private final ResourceLoader applicationResourceLoader;
+ private final TypeHelper typeHelper;
+ private String webAppName;
+
+ public AssemblyContextImpl(AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader) {
+ this(new AssemblyFactoryImpl(), assemblyLoader, resourceLoader);
+ }
+
+ public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader) {
+ this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper());
+ }
+
+ public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, String webAppName) {
+ this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), webAppName);
+ }
+ public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper) {
+ this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), null);
+ }
+
+ public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper, String webAppName) {
+ this.assemblyFactory = assemblyFactory;
+ this.assemblyLoader = assemblyLoader;
+ this.applicationResourceLoader = artifactLoader;
+ this.typeHelper=typeHelper;
+ this.webAppName=webAppName;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyFactory()
+ */
+ public AssemblyFactory getAssemblyFactory() {
+ return assemblyFactory;
+ }
+
+ public ResourceLoader getApplicationResourceLoader() {
+ return applicationResourceLoader;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyLoader()
+ */
+ public AssemblyModelLoader getAssemblyLoader() {
+ return assemblyLoader;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyContext#getTypeHelper()
+ */
+ public TypeHelper getTypeHelper() {
+ return typeHelper;
+ }
+
+ public String getWebAppName() {
+ return webAppName;
+ }
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
new file mode 100644
index 0000000000..c88ea4448f
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
@@ -0,0 +1,217 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.model.assembly.Part;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.ConfiguredPort;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.ModuleFragment;
+import org.apache.tuscany.model.assembly.Multiplicity;
+import org.apache.tuscany.model.assembly.Property;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceURI;
+import org.apache.tuscany.model.assembly.AtomicComponent;
+import org.apache.tuscany.model.assembly.Subsystem;
+import org.apache.tuscany.model.assembly.Wire;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.assembly.ImportWSDL;
+import org.apache.tuscany.model.types.java.JavaServiceContract;
+import org.apache.tuscany.model.types.java.impl.JavaServiceContractImpl;
+import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
+import org.apache.tuscany.model.types.wsdl.impl.WSDLServiceContractImpl;
+
+/**
+ * Default implementation of AssemblyFactory
+ */
+public class AssemblyFactoryImpl implements AssemblyFactory {
+
+ /**
+ * Constructor
+ */
+ public AssemblyFactoryImpl() {
+ super();
+ }
+
+ public AtomicComponent createSimpleComponent() {
+ return new AtomicComponentImpl();
+ }
+
+ public ComponentType createComponentType() {
+ return new ComponentTypeImpl();
+ }
+
+ public EntryPoint createEntryPoint() {
+ return new EntryPointImpl();
+ }
+
+ public ExternalService createExternalService() {
+ return new ExternalServiceImpl();
+ }
+
+ public JavaServiceContract createJavaServiceContract() {
+ return new JavaServiceContractImpl();
+ }
+
+ public Module createModule() {
+ return new ModuleImpl();
+ }
+
+ public ModuleFragment createModuleFragment() {
+ return new ModuleFragmentImpl();
+ }
+
+ public ModuleComponent createModuleComponent() {
+ return new ModuleComponentImpl();
+ }
+
+ public Property createProperty() {
+ return new PropertyImpl();
+ }
+
+ public ConfiguredProperty createConfiguredProperty() {
+ return new ConfiguredPropertyImpl();
+ }
+
+ public Reference createReference() {
+ return new ReferenceImpl();
+ }
+
+ public ConfiguredReference createConfiguredReference() {
+ return new ConfiguredReferenceImpl();
+ }
+
+ public Service createService() {
+ return new ServiceImpl();
+ }
+
+ public ConfiguredService createConfiguredService() {
+ return new ConfiguredServiceImpl();
+ }
+
+ public Subsystem createSubsystem() {
+ return new SubsystemImpl();
+ }
+
+ public WSDLServiceContract createWSDLServiceContract() {
+ return new WSDLServiceContractImpl();
+ }
+
+ public ServiceURI createServiceURI(String uri) {
+ return new ServiceURIImpl(uri);
+ }
+
+ public ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName) {
+ return new ServiceURIImpl(moduleComponent, serviceName);
+ }
+
+ public ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) {
+ return new ServiceURIImpl(moduleComponent, part, configuredPort);
+ }
+
+ public ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName) {
+ return new ServiceURIImpl(moduleComponent,partName,serviceName);
+ }
+
+ public QName createQName(String uri) {
+ int h = uri.indexOf('#');
+ return new QName(uri.substring(0, h), uri.substring(h + 1));
+ }
+
+ public Wire createWire() {
+ return new WireImpl();
+ }
+
+ public Reference createReference(String name, Class<?> service) {
+ return createReference(name,service,Multiplicity.ZERO_ONE);
+ }
+
+ public Reference createReference(String name, Class<?> service, Multiplicity multiplicity){
+ JavaServiceContract refContract = createJavaServiceContract();
+ refContract.setInterface(service);
+ Reference reference = createReference();
+ reference.setName(name);
+ reference.setServiceContract(refContract);
+ reference.setMultiplicity(multiplicity);
+ return reference;
+ }
+
+ public ConfiguredReference createConfiguredReference(String name, String... targets) {
+ ConfiguredReference ref = createConfiguredReference();
+ ref.setName(name);
+ for (String target : targets) {
+ ref.getTargets().add(target);
+ }
+ return ref;
+ }
+
+ public EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName) {
+ // create and configure the exposed service
+ Service service = createService();
+ service.setName(entryPointName);
+ service.setServiceContract(serviceContract);
+ ConfiguredService configuredService = createConfiguredService();
+ configuredService.setPort(service);
+
+ // create and configure a reference to target
+ Reference reference = createReference();
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ reference.setServiceContract(serviceContract);
+ ConfiguredReference configuredReference = createConfiguredReference(null, targetName);
+ configuredReference.setPort(reference);
+
+ return createEntryPoint(entryPointName, configuredService, binding, configuredReference);
+ }
+
+ public EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference) {
+ EntryPoint entryPoint = createEntryPoint();
+ entryPoint.setName(entryPointName);
+ entryPoint.setConfiguredService(configuredService);
+ entryPoint.setConfiguredReference(configuredReference);
+ entryPoint.getBindings().add((Binding)binding);
+ return entryPoint;
+ }
+
+ public Property createProperty(String name, Class<?> type) {
+ Property property = createProperty();
+ property.setName(name);
+ property.setType(type);
+ return property;
+ }
+
+ public ImportWSDL createImportWSDL() {
+ return new ImportWSDLImpl();
+ }
+
+ public ImportWSDL createImportWSDL(String location, String namespace) {
+ ImportWSDL importWSDL = createImportWSDL();
+ importWSDL.setLocation(location);
+ importWSDL.setNamespace(namespace);
+ return importWSDL;
+ }
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java
new file mode 100644
index 0000000000..38056e1e1c
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java
@@ -0,0 +1,123 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyObject;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+
+/**
+ * A base class for assembly model objects.
+ */
+public abstract class AssemblyObjectImpl implements AssemblyObject {
+
+ private boolean frozen;
+ private boolean initialized;
+
+ protected AssemblyObjectImpl() {
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ return visitor.visit(this);
+ }
+
+ /**
+ * Walk a visitor through a collection of model objects.
+ * @param collection
+ * @param visitor
+ */
+ protected boolean accept(Collection collection, AssemblyVisitor visitor) {
+ for (Object member : collection) {
+ if (member instanceof AssemblyObject) {
+ if (!((AssemblyObject)member).accept(visitor))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void freeze() {
+ if (!frozen)
+ frozen=true;
+ }
+
+ /**
+ * Returns true if the object is frozen
+ */
+ protected boolean isFrozen() {
+ return frozen;
+ }
+
+ /**
+ * Freeze a list and its members
+ */
+ protected <T> List<T> freeze(List<T> list) {
+ list=Collections.unmodifiableList(list);
+ for (Object member : list) {
+ if (member instanceof AssemblyObject) {
+ ((AssemblyObject)member).freeze();
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Check that the current model object can be modified.
+ * @throws IllegalStateException
+ */
+ protected void checkNotFrozen() {
+ if (frozen)
+ throw new IllegalStateException("Attempt to modify a frozen assembly model");
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (!initialized)
+ initialized=true;
+ }
+
+ /**
+ * Returns true if the object is initialized
+ */
+ protected boolean isInitialized() {
+ return initialized;
+ }
+
+ /**
+ * Initialize members of a collection
+ */
+ protected void initialize(Collection collection, AssemblyContext modelContext) {
+ for (Object member : collection) {
+ if (member instanceof AssemblyObject) {
+ ((AssemblyObject)member).initialize(modelContext);
+ }
+ }
+ }
+
+ /**
+ * Check that the current model object is initialized.
+ * @throws IllegalStateException
+ */
+ protected void checkInitialized() {
+ if (!initialized)
+ throw new IllegalStateException("Attempt to use an uninitialized assembly model");
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java
new file mode 100644
index 0000000000..186d685d12
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AtomicComponent;
+import org.apache.tuscany.model.assembly.AtomicImplementation;
+
+/**
+ * An implementation of AtomicComponent.
+ */
+public class AtomicComponentImpl extends ComponentImpl<AtomicImplementation> implements AtomicComponent {
+
+ protected AtomicComponentImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java
new file mode 100644
index 0000000000..1f85afa2cc
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java
@@ -0,0 +1,29 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AtomicImplementation;
+
+/**
+ * An implementation of AtomicImplementation.
+ */
+public abstract class AtomicImplementationImpl extends ImplementationImpl implements AtomicImplementation {
+
+ protected AtomicImplementationImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java
new file mode 100644
index 0000000000..c13dabb17e
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Binding;
+
+/**
+ * An implementation of Binding.
+ */
+public class BindingImpl extends ExtensibleImpl implements Binding {
+
+ private String uri;
+
+ protected BindingImpl() {
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String value) {
+ checkNotFrozen();
+ uri=value;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java
new file mode 100644
index 0000000000..a952ebe34d
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java
@@ -0,0 +1,213 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyInitializationException;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.ConfiguredPort;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Implementation;
+import org.apache.tuscany.model.assembly.Property;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.util.NotifyingList;
+
+/**
+ * An implementation of Component.
+ */
+public abstract class ComponentImpl<I extends Implementation> extends PartImpl implements Component<I> {
+
+ /**
+ * A list of configured ports synchronized with a map
+ */
+ private class ConfiguredPortList<E extends ConfiguredPort> extends NotifyingList<E>{
+
+ Map<String, E> map;
+
+ private ConfiguredPortList(Map<String, E> map) {
+ this.map=map;
+ }
+
+ protected void added(E element) {
+ String name=element.getPort()!=null? element.getPort().getName():element.getName();
+ map.put(name, element);
+ element.setPart(ComponentImpl.this);
+ }
+ protected void removed(E element) {
+ String name=element.getPort()!=null? element.getPort().getName():element.getName();
+ map.remove(name);
+ element.setPart(null);
+ }
+ }
+
+ private Map<String, ConfiguredReference> configuredReferencesMap = new HashMap<String, ConfiguredReference>();
+ private List<ConfiguredReference> configuredReferences = new ConfiguredPortList<ConfiguredReference>(configuredReferencesMap);
+
+ private Map<String, ConfiguredService> configuredServicesMap = new HashMap<String, ConfiguredService>();
+ private List<ConfiguredService> configuredServices = new ConfiguredPortList<ConfiguredService>(configuredServicesMap);
+
+ /**
+ * A list of properties synchronized with a map
+ */
+ private class ConfiguredPropertyList<E extends ConfiguredProperty> extends NotifyingList<E>{
+
+ protected void added(E element) {
+ String name=element.getProperty()!=null? element.getProperty().getName():element.getName();
+ configuredPropertiesMap.put(name, element);
+ }
+ protected void removed(E element) {
+ String name=element.getProperty()!=null? element.getProperty().getName():element.getName();
+ configuredPropertiesMap.remove(name);
+ }
+ }
+
+ private List<ConfiguredProperty> configuredProperties = new ConfiguredPropertyList<ConfiguredProperty>();
+ private Map<String, ConfiguredProperty> configuredPropertiesMap=new HashMap<String, ConfiguredProperty>();
+
+ private I implementation;
+
+ public I getImplementation() {
+ return implementation;
+ }
+
+ public void setImplementation(I value) {
+ checkNotFrozen();
+ implementation = value;
+ }
+
+ public List<ConfiguredService> getConfiguredServices() {
+ return configuredServices;
+ }
+
+ public ConfiguredService getConfiguredService(String name) {
+ return configuredServicesMap.get(name);
+ }
+
+ public List<ConfiguredReference> getConfiguredReferences() {
+ return configuredReferences;
+ }
+
+ public ConfiguredReference getConfiguredReference(String name) {
+ return configuredReferencesMap.get(name);
+ }
+
+ public List<ConfiguredProperty> getConfiguredProperties() {
+ return configuredProperties;
+ }
+
+ public ConfiguredProperty getConfiguredProperty(String name) {
+ return configuredPropertiesMap.get(name);
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize the implementation
+ if (implementation == null) {
+ throw new AssemblyInitializationException("No implementation for component [" + getName() + ']');
+ }
+ implementation.initialize(modelContext);
+
+ // Derive the configured services from the component implementation
+ ComponentType componentType=implementation.getComponentType();
+ AssemblyFactory factory = modelContext.getAssemblyFactory();
+ for (Service service : componentType.getServices()) {
+ ConfiguredService configuredService = factory.createConfiguredService();
+ configuredService.setPort(service);
+ configuredServices.add(configuredService);
+ configuredService.initialize(modelContext);
+ }
+
+ // Derive the configured references from the references on the component info
+ for (Reference reference : componentType.getReferences()) {
+ ConfiguredReference configuredReference = configuredReferencesMap.get(reference.getName());
+ if (configuredReference==null) {
+ configuredReference=factory.createConfiguredReference();
+ configuredReference.setPort(reference);
+ configuredReferences.add(configuredReference);
+ configuredReference.initialize(modelContext);
+ } else {
+ configuredReference.setPort(reference);
+ configuredReference.initialize(modelContext);
+ }
+ }
+ for (ConfiguredReference configuredReference : configuredReferences) {
+ if (configuredReference.getPort()==null) {
+ throw new AssemblyInitializationException("Undefined reference ["+configuredReference.getName()+"]");
+ }
+ }
+
+ // Derive the configured properties from the properties on the component info
+ for (Property property : componentType.getProperties()) {
+ ConfiguredProperty configuredProperty = configuredPropertiesMap.get(property.getName());
+ if (configuredProperty != null) {
+ configuredProperty.setProperty(property);
+ configuredProperty.initialize(modelContext);
+ }
+ }
+ for (ConfiguredProperty configuredProperty : configuredProperties) {
+ if (configuredProperty.getProperty()==null) {
+ throw new AssemblyInitializationException("Undefined property ["+configuredProperty.getName()+"]");
+ }
+ }
+
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze configured services, references and properties
+ configuredServices = freeze(configuredServices);
+ configuredReferences = freeze(configuredReferences);
+ configuredProperties = freeze(configuredProperties);
+ if (implementation != null)
+ implementation.freeze();
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(configuredServices, visitor))
+ return false;
+ if (!accept(configuredReferences, visitor))
+ return false;
+ if (!accept(configuredProperties, visitor))
+ return false;
+ if (implementation != null) {
+ if (!implementation.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java
new file mode 100644
index 0000000000..617206b6af
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java
@@ -0,0 +1,147 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.Port;
+import org.apache.tuscany.model.assembly.Property;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.util.NotifyingList;
+
+/**
+ * An implementation of ComponentType.
+ */
+public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType {
+
+ /**
+ * A list of ports synchronized with a map
+ */
+ private class PortList<E extends Port> extends NotifyingList<E>{
+
+ Map<String, E> map;
+
+ private PortList(Map<String, E> map) {
+ this.map=map;
+ }
+
+ protected void added(E element) {
+ map.put(element.getName(), element);
+ }
+ protected void removed(E element) {
+ map.remove(element.getName());
+ }
+ }
+
+ private Map<String, Reference> referencesMap=new HashMap<String, Reference>();
+ private List<Reference> references=new PortList<Reference>(referencesMap);
+
+ private Map<String, Service> servicesMap=new HashMap<String, Service>();
+ private List<Service> services=new PortList<Service>(servicesMap);
+
+ /**
+ * A list of properties synchronized with a map
+ */
+ private class PropertyList<E extends Property> extends NotifyingList<E>{
+
+ protected void added(E element) {
+ propertiesMap.put(element.getName(), element);
+ }
+ protected void removed(E element) {
+ propertiesMap.remove(element.getName());
+ }
+ }
+
+ private Map<String, Property> propertiesMap=new HashMap<String, Property>();
+ private List<Property> properties=new PropertyList<Property>();
+
+ protected ComponentTypeImpl() {
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public Reference getReference(String name) {
+ return referencesMap.get(name);
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public Service getService(String name) {
+ return servicesMap.get(name);
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public Property getProperty(String name) {
+ return propertiesMap.get(name);
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize references, properties and services
+ for (Reference reference : references) {
+ reference.initialize(modelContext);
+ }
+ for (Property property : properties) {
+ property.initialize(modelContext);
+ }
+ for (Service service : services) {
+ service.initialize(modelContext);
+ }
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze lists of services, references and properties
+ services=freeze(services);
+ references=freeze(references);
+ properties=freeze(properties);
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(services, visitor))
+ return false;
+ if (!accept(references, visitor))
+ return false;
+ if (!accept(properties, visitor))
+ return false;
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java
new file mode 100644
index 0000000000..fff32e3398
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java
@@ -0,0 +1,357 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.Composite;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Implementation;
+import org.apache.tuscany.model.assembly.ImportWSDL;
+import org.apache.tuscany.model.assembly.Multiplicity;
+import org.apache.tuscany.model.assembly.OverrideOption;
+import org.apache.tuscany.model.assembly.Part;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.assembly.ServiceURI;
+import org.apache.tuscany.model.assembly.Wire;
+import org.apache.tuscany.model.util.NotifyingList;
+
+/**
+ * An implementation of Composite.
+ */
+public abstract class CompositeImpl extends ExtensibleImpl implements Composite {
+
+ private String name;
+ private ComponentType componentType;
+ private Class<?> implementationClass;
+
+ /**
+ * A list of parts synchronized with a map
+ */
+ private class PartList<E extends Part> extends NotifyingList<E> {
+ protected void added(E element) {
+ partsMap.put(element.getName(), element);
+ element.setComposite(CompositeImpl.this);
+ }
+
+ protected void removed(E element) {
+ partsMap.remove(element.getName());
+ element.setComposite(null);
+ }
+ }
+
+ private Map<String, Part> partsMap = new HashMap<String, Part>();
+
+ private List<Component> components = new PartList<Component>();
+ private List<EntryPoint> entryPoints = new PartList<EntryPoint>();
+ private List<ExternalService> externalServices = new PartList<ExternalService>();
+
+ private List<Wire> wires = new ArrayList<Wire>();
+
+ /**
+ * A list of WSDL imports synchronized with a map
+ */
+ private class ImportWSDLList extends NotifyingList<ImportWSDL> {
+ protected void added(ImportWSDL element) {
+ List<ImportWSDL> importList = wsdlImportsMap.get(element.getNamespace());
+ if (importList == null) {
+ importList = new ArrayList<ImportWSDL>();
+ wsdlImportsMap.put(element.getNamespace(), importList);
+ }
+ importList.add(element);
+ }
+
+ protected void removed(ImportWSDL element) {
+ List<ImportWSDL> importList = wsdlImportsMap.get(element.getNamespace());
+ if (importList != null) {
+ importList.remove(element);
+ if (importList.isEmpty())
+ wsdlImportsMap.remove(element.getNamespace());
+ }
+ }
+ }
+
+ private Map<String, List<ImportWSDL>> wsdlImportsMap = new HashMap<String, List<ImportWSDL>>();
+
+ private List<ImportWSDL> wsdlImports = new ImportWSDLList();
+
+ protected CompositeImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String newName) {
+ checkNotFrozen();
+ name = newName;
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ public List<EntryPoint> getEntryPoints() {
+ return entryPoints;
+ }
+
+ public List<ExternalService> getExternalServices() {
+ return externalServices;
+ }
+
+ public Part getPart(String name) {
+ return partsMap.get(name);
+ }
+
+ public List<Wire> getWires() {
+ return wires;
+ }
+
+ public List<ImportWSDL> getWSDLImports() {
+ return wsdlImports;
+ }
+
+ public List<ImportWSDL> getWSDLImports(String namespace) {
+ return wsdlImportsMap.get(namespace);
+ }
+
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ public void setComponentType(ComponentType componentType) {
+ checkNotFrozen();
+ this.componentType = componentType;
+ }
+
+ public ConfiguredService getConfiguredService(ServiceURI address) {
+ String partName = address.getPartName();
+ String serviceName = address.getServiceName();
+ Part part = getPart(partName);
+ if (part instanceof Component) {
+ Component<?> component = (Component<?>) part;
+ if (serviceName != null) {
+ return component.getConfiguredService(serviceName);
+ } else {
+ if (!component.getConfiguredServices().isEmpty()) {
+ return component.getConfiguredServices().get(0);
+ } else {
+ return null;
+ }
+ }
+
+ }
+ if (part instanceof ExternalService) {
+ ExternalService externalService = (ExternalService) part;
+ return externalService.getConfiguredService();
+ } else
+ return null;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize WSDL imports
+ for (ImportWSDL importWSDL : wsdlImports) {
+ importWSDL.initialize(modelContext);
+ }
+
+ // Initialize parts
+ for (Part part : externalServices) {
+ part.initialize(modelContext);
+ }
+ for (Part part : components) {
+ part.initialize(modelContext);
+ }
+ for (Part part : entryPoints) {
+ part.initialize(modelContext);
+ }
+
+ // Derive the component type from the entry points and external services in the composite
+ // Also derive properties from the overridable properties of the components in the composite
+ if (componentType == null) {
+ AssemblyFactory factory = modelContext.getAssemblyFactory();
+ componentType = factory.createComponentType();
+ for (EntryPoint entryPoint : getEntryPoints()) {
+ Service service = factory.createService();
+ service.setName(entryPoint.getName());
+ ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract();
+ if (serviceContract != null)
+ service.setServiceContract(serviceContract);
+ componentType.getServices().add(service);
+
+ ConfiguredReference configuredReference = entryPoint.getConfiguredReference();
+ ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference);
+ for (String target : configuredReference.getTargets()) {
+ ServiceURI targetURI = factory.createServiceURI(null, target);
+ Wire wire = factory.createWire();
+ wire.setSource(sourceURI);
+ wire.setTarget(targetURI);
+ getWires().add(wire);
+ }
+ }
+ for (ExternalService externalService : getExternalServices()) {
+ if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO)
+ continue;
+ Reference reference = factory.createReference();
+ reference.setName(externalService.getName());
+ ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract();
+ if (serviceContract != null)
+ reference.setServiceContract(serviceContract);
+ componentType.getReferences().add(reference);
+ }
+ for (Component<Implementation> component : getComponents()) {
+ for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) {
+ if (configuredProperty.getOverrideOption() == null || configuredProperty.getOverrideOption() == OverrideOption.NO)
+ continue;
+ componentType.getProperties().add(configuredProperty.getProperty());
+ }
+
+ for (ConfiguredReference configuredReference : component.getConfiguredReferences()) {
+ // Create a wire
+ ServiceURI sourceURI = factory.createServiceURI(null, component, configuredReference);
+ for (String target : configuredReference.getTargets()) {
+ ServiceURI targetURI = factory.createServiceURI(null, target);
+ Wire wire = factory.createWire();
+ wire.setSource(sourceURI);
+ wire.setTarget(targetURI);
+ getWires().add(wire);
+ }
+ }
+ }
+ }
+ componentType.initialize(modelContext);
+
+ // Wire the parts in this composite
+ wire(modelContext);
+ }
+
+ /**
+ * Wire the parts in this composite.
+ * @param modelContext
+ */
+ protected void wire(AssemblyContext modelContext) {
+ for (Wire wire : getWires()) {
+
+ // Get the source reference
+ ServiceURI sourceURI = wire.getSource();
+ ConfiguredReference configuredReference = null;
+ String partName = sourceURI.getPartName();
+ String referenceName = sourceURI.getServiceName();
+ if (referenceName != null) {
+ //Component<?> component = (Component<?>)getPart(partName);
+// if (component != null) {
+ Part part = getPart(partName);
+ if (part instanceof Component) {
+ configuredReference = ((Component) part).getConfiguredReference(referenceName);
+ } else if (part instanceof EntryPoint) {
+ configuredReference = ((EntryPoint) part).getConfiguredReference();
+ }
+ } else {
+ EntryPoint entryPoint = (EntryPoint) getPart(partName);
+ if (entryPoint != null) {
+ configuredReference = entryPoint.getConfiguredReference();
+ }
+ }
+ if (configuredReference == null) {
+ throw new IllegalArgumentException("Cannot find wire source " + sourceURI.getPath());
+ } else {
+
+ // Resolve the target service endpoint
+ ServiceURI targetURI = wire.getTarget();
+ ConfiguredService configuredService = getConfiguredService(targetURI);
+ if (configuredService != null) {
+
+ // Wire the reference to the target
+ Multiplicity multiplicity = configuredReference.getPort().getMultiplicity();
+ if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) {
+ configuredReference.getTargetConfiguredServices().add(configuredService);
+ } else {
+ configuredReference.getTargetConfiguredServices().clear();
+ configuredReference.getTargetConfiguredServices().add(configuredService);
+ }
+ } else {
+ throw new IllegalArgumentException("Cannot find service '" + targetURI.getPath() +"'.");
+ }
+ }
+ }
+ }
+
+ public Class<?> getImplementationClass() {
+ return implementationClass;
+ }
+
+ public void setImplementationClass(Class<?> clazz) {
+ checkNotFrozen();
+ this.implementationClass = clazz;
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze component type
+ if (componentType != null)
+ componentType.freeze();
+
+ // Freeze lists
+ wsdlImports = freeze(wsdlImports);
+ components = freeze(components);
+ entryPoints = freeze(entryPoints);
+ externalServices = freeze(externalServices);
+ wires = freeze(wires);
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(wsdlImports, visitor))
+ return false;
+
+ if (!accept(partsMap.values(), visitor))
+ return false;
+
+ if (!accept(wires, visitor))
+ return false;
+
+ if (componentType != null) {
+ if (!componentType.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java
new file mode 100644
index 0000000000..f1007e8c07
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java
@@ -0,0 +1,106 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Part;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.ConfiguredPort;
+import org.apache.tuscany.model.assembly.Port;
+
+/**
+ * Implementation of ConfiguredPort.
+ */
+public abstract class ConfiguredPortImpl<P extends Port> extends AssemblyObjectImpl implements ConfiguredPort<P> {
+ private String name;
+ private Part part;
+ private P port;
+
+ private Object proxyFactory;
+
+ protected ConfiguredPortImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ checkNotFrozen();
+ this.name=name;
+ }
+
+ public P getPort() {
+ return port;
+ }
+
+ public void setPort(P port) {
+ checkNotFrozen();
+ this.port = port;
+ }
+
+ public Part getPart() {
+ return part;
+ }
+
+ public void setPart(Part part) {
+ checkNotFrozen();
+ this.part=part;
+ }
+
+ public Object getProxyFactory() {
+ return proxyFactory;
+ }
+
+ public void setProxyFactory(Object proxyFactory) {
+ checkNotFrozen();
+ this.proxyFactory = proxyFactory;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ if (port!=null) {
+ name=port.getName();
+ port.initialize(modelContext);
+ }
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ if (port!=null)
+ port.freeze();
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (port!=null) {
+ if (!port.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java
new file mode 100644
index 0000000000..4c64676451
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.OverrideOption;
+import org.apache.tuscany.model.assembly.Property;
+
+/**
+ * Implementation of ConfiguredProperty
+ */
+public class ConfiguredPropertyImpl extends AssemblyObjectImpl implements ConfiguredProperty {
+ private String name;
+ private OverrideOption overrideOption;
+ private Object value;
+ private Property property;
+
+ protected ConfiguredPropertyImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Property getProperty() {
+ return property;
+ }
+
+ public void setProperty(Property property) {
+ checkNotFrozen();
+ this.property = property;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ checkNotFrozen();
+ this.value = value;
+ }
+
+ public OverrideOption getOverrideOption() {
+ return overrideOption;
+ }
+
+ public void setOverrideOption(OverrideOption value) {
+ checkNotFrozen();
+ this.overrideOption=value;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ if (property!=null)
+ property.initialize(modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ if (property!=null)
+ property.freeze();
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (property!=null) {
+ if (!property.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java
new file mode 100644
index 0000000000..f21a5be52e
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java
@@ -0,0 +1,53 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Reference;
+
+/**
+ * An implementation of ConfiguredReference.
+ */
+public class ConfiguredReferenceImpl extends ConfiguredPortImpl<Reference> implements ConfiguredReference {
+
+ private List<String> targets = new ArrayList<String>();
+
+ private List<ConfiguredService> targetConfiguredServices = new ArrayList<ConfiguredService>();
+
+ protected ConfiguredReferenceImpl() {
+ }
+
+ public List<String> getTargets() {
+ return targets;
+ }
+
+ public List<ConfiguredService> getTargetConfiguredServices() {
+ return targetConfiguredServices;
+ }
+
+ public void freeze() {
+ super.freeze();
+
+ targetConfiguredServices = freeze(targetConfiguredServices);
+ targets = freeze(targets);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java
new file mode 100644
index 0000000000..923af1882c
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Service;
+
+/**
+ * An implementation of ConfiguredService.
+ */
+public class ConfiguredServiceImpl extends ConfiguredPortImpl<Service> implements ConfiguredService {
+
+ protected ConfiguredServiceImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java
new file mode 100644
index 0000000000..a894a7c48f
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java
@@ -0,0 +1,116 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+
+/**
+ * An implementation of EntryPoint.
+ */
+public class EntryPointImpl extends PartImpl implements EntryPoint {
+
+ private ConfiguredService configuredService;
+ private ConfiguredReference configuredReference;
+ private List<Binding> bindings=new ArrayList<Binding>();
+
+ protected EntryPointImpl() {
+ }
+
+ public ConfiguredReference getConfiguredReference() {
+ return configuredReference;
+ }
+
+ public void setConfiguredReference(ConfiguredReference configuredReference) {
+ checkNotFrozen();
+ configuredReference.setPart(this);
+ this.configuredReference=configuredReference;
+ }
+
+ public ConfiguredService getConfiguredService() {
+ return configuredService;
+ }
+
+ public void setConfiguredService(ConfiguredService configuredService) {
+ checkNotFrozen();
+ configuredService.setPart(this);
+ this.configuredService=configuredService;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize the service contract and reference to the published service
+ if (configuredReference != null) {
+ configuredReference.initialize(modelContext);
+ }
+ if (configuredService != null) {
+ configuredService.initialize(modelContext);
+ }
+
+ // Initialize the bindings
+ initialize(bindings, modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze the service contract and configured reference
+ if (configuredReference != null)
+ configuredReference.freeze();
+ if (configuredService != null)
+ configuredService.freeze();
+
+ // Freeze the bindings
+ bindings=freeze(bindings);
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (configuredReference!=null) {
+ if (!configuredReference.accept(visitor))
+ return false;
+ }
+
+ if (configuredService!=null) {
+ if (!configuredService.accept(visitor))
+ return false;
+ }
+
+ if (!accept(bindings, visitor))
+ return false;
+
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java
new file mode 100644
index 0000000000..6adf66dc9e
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java
@@ -0,0 +1,75 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Extensible;
+
+/**
+ * An implementation of Extensible.
+ */
+public abstract class ExtensibleImpl extends AssemblyObjectImpl implements Extensible {
+
+ private List<Object> extensibilityElements = new ArrayList<Object>();
+ private List<Object> extensibilityAttributes = new ArrayList<Object>();
+
+ protected ExtensibleImpl() {
+ }
+
+ public List<Object> getExtensibilityElements() {
+ return extensibilityElements;
+ }
+
+ public List<Object> getExtensibilityAttributes() {
+ return extensibilityAttributes;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize extensibility elements and attributes
+ initialize(extensibilityElements, modelContext);
+ initialize(extensibilityAttributes, modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze extensibility elements and attributes
+ freeze(extensibilityElements);
+ freeze(extensibilityAttributes);
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(extensibilityElements, visitor))
+ return false;
+ return accept(extensibilityAttributes, visitor);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java
new file mode 100644
index 0000000000..9110731c34
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java
@@ -0,0 +1,116 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.OverrideOption;
+
+/**
+ * An implementation ExternalService.
+ */
+public class ExternalServiceImpl extends PartImpl implements ExternalService {
+
+ private ConfiguredService configuredService;
+ private OverrideOption overrideOption;
+ private List<Binding> bindings=new ArrayList<Binding>();
+
+ private Object contextFactory;
+
+ protected ExternalServiceImpl() {
+ }
+
+ public OverrideOption getOverrideOption() {
+ return overrideOption;
+ }
+
+ public void setOverrideOption(OverrideOption newOverridable) {
+ checkNotFrozen();
+ overrideOption=newOverridable;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public ConfiguredService getConfiguredService() {
+ return configuredService;
+ }
+
+ public void setConfiguredService(ConfiguredService configuredService) {
+ checkNotFrozen();
+ configuredService.setPart(this);
+ this.configuredService=configuredService;
+ }
+
+ public Object getContextFactory() {
+ return contextFactory;
+ }
+
+ public void setContextFactory(Object contextFactory) {
+ this.contextFactory=contextFactory;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize the configured service
+ if (configuredService != null) {
+ configuredService.initialize(modelContext);
+ }
+
+ // Initialize the bindings
+ initialize(bindings, modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze the configured service
+ if (configuredService!= null)
+ configuredService.freeze();
+
+ // Freeze the bindings
+ bindings=freeze(bindings);
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (configuredService!=null) {
+ if (!configuredService.accept(visitor))
+ return false;
+ }
+
+ if (!accept(bindings, visitor))
+ return false;
+
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java
new file mode 100644
index 0000000000..a44d80cc66
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java
@@ -0,0 +1,72 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.Implementation;
+
+/**
+ * An implementation of Implementation.
+ */
+public abstract class ImplementationImpl extends ExtensibleImpl implements Implementation {
+
+ private ComponentType componentType;
+
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ public void setComponentType(ComponentType componentType) {
+ checkNotFrozen();
+ this.componentType=componentType;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize the component type
+ if (componentType!=null) {
+ componentType.initialize(modelContext);
+ }
+
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ if (componentType!=null)
+ componentType.freeze();
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (componentType!=null) {
+ if (!componentType.accept(visitor))
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
new file mode 100644
index 0000000000..56aedd18f5
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
@@ -0,0 +1,82 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.net.URL;
+
+import javax.wsdl.Definition;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.ImportWSDL;
+
+/**
+ * Implementation of ImportWSDL.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportWSDLImpl extends AssemblyObjectImpl implements ImportWSDL {
+ private String location;
+ private String namespace;
+ private Definition definition;
+
+ protected ImportWSDLImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String uri) {
+ checkNotFrozen();
+ this.location = uri;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String uri) {
+ checkNotFrozen();
+ this.namespace = uri;
+ }
+
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(Definition definition) {
+ checkNotFrozen();
+ this.definition = definition;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Load the WSDL definition if necessary
+ ResourceLoader resourceLoader = modelContext.getApplicationResourceLoader();
+ if (definition == null) {
+ URL url = resourceLoader.getResource(location);
+ if (url == null)
+ throw new IllegalArgumentException("Cannot find " + location);
+ definition = modelContext.getAssemblyLoader().loadDefinition(url.toString());
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java
new file mode 100644
index 0000000000..60cb42a981
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+
+/**
+ * An implementation of ModuleComponent.
+ */
+public class ModuleComponentImpl extends ComponentImpl<Module> implements ModuleComponent {
+
+ private String uri;
+
+ protected ModuleComponentImpl() {
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String value) {
+ checkNotFrozen();
+ uri=value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java
new file mode 100644
index 0000000000..08536d23b8
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.ModuleFragment;
+
+/**
+ * An implementation of ModuleFragment.
+ */
+public class ModuleFragmentImpl extends CompositeImpl implements ModuleFragment {
+
+ protected ModuleFragmentImpl() {
+ }
+
+ protected void wire(AssemblyContext modelContext) {
+ // No wiring inside a module fragment
+ // Wires are handled at the module level
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java
new file mode 100644
index 0000000000..f64317ac86
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java
@@ -0,0 +1,104 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleFragment;
+import org.apache.tuscany.model.util.NotifyingList;
+
+/**
+ * An implementation of Module.
+ */
+public class ModuleImpl extends CompositeImpl implements Module {
+
+ /**
+ * A list of module fragments synchronized with a map
+ */
+ private class ModuleFragmentList<E extends ModuleFragment> extends NotifyingList<E> {
+ protected void added(E element) {
+ moduleFragmentsMap.put(element.getName(), element);
+ }
+
+ protected void removed(E element) {
+ moduleFragmentsMap.remove(element.getName());
+ }
+ }
+
+ private List<ModuleFragment> moduleFragments = new ModuleFragmentList<ModuleFragment>();
+ private Map<String, ModuleFragment> moduleFragmentsMap = new HashMap<String, ModuleFragment>();
+
+ /**
+ * Constructor
+ */
+ protected ModuleImpl() {
+ }
+
+ public List<ModuleFragment> getModuleFragments() {
+ return moduleFragments;
+ }
+
+ public ModuleFragment getModuleFragment(String name) {
+ checkInitialized();
+ return moduleFragmentsMap.get(name);
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+
+ // Initialize module fragments
+ for (ModuleFragment moduleFragment : moduleFragments) {
+
+ // Add all WSDL imports, components, entry points and external services from the module fragments
+ getWSDLImports().addAll(moduleFragment.getWSDLImports());
+ getComponents().addAll(moduleFragment.getComponents());
+ getEntryPoints().addAll(moduleFragment.getEntryPoints());
+ getExternalServices().addAll(moduleFragment.getExternalServices());
+
+ // Add all the wires from the module fragments
+ getWires().addAll(moduleFragment.getWires());
+
+ moduleFragment.initialize(modelContext);
+ }
+
+ // Initialize the composite
+ super.initialize(modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ moduleFragments = freeze(moduleFragments);
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ return accept(moduleFragments, visitor);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java
new file mode 100644
index 0000000000..3743c7505b
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Composite;
+import org.apache.tuscany.model.assembly.Part;
+
+/**
+ * Implementation of Part.
+ */
+public abstract class PartImpl extends ExtensibleImpl implements Part {
+ private Composite composite;
+ private String name;
+
+ private Object contextFactory;
+
+ protected PartImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ checkNotFrozen();
+ name=value;
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+ public void setComposite(Composite composite) {
+ checkNotFrozen();
+ this.composite=composite;
+ }
+
+ public Object getContextFactory() {
+ return contextFactory;
+ }
+
+ public void setContextFactory(Object contextFactory) {
+ checkNotFrozen();
+ this.contextFactory=contextFactory;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java
new file mode 100644
index 0000000000..c11cee590a
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java
@@ -0,0 +1,82 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.AssemblyVisitor;
+import org.apache.tuscany.model.assembly.Port;
+import org.apache.tuscany.model.assembly.ServiceContract;
+
+/**
+ * An implementation of Port.
+ */
+public abstract class PortImpl extends AssemblyObjectImpl implements Port {
+
+ private ServiceContract serviceContract;
+ private String name;
+
+ protected PortImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ checkNotFrozen();
+ name=value;
+ }
+
+ public ServiceContract getServiceContract() {
+ return serviceContract;
+ }
+
+ public void setServiceContract(ServiceContract value) {
+ checkNotFrozen();
+ serviceContract=value;
+ }
+
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ if (serviceContract!=null)
+ serviceContract.initialize(modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ if (serviceContract!=null)
+ serviceContract.freeze();
+ }
+
+ public boolean accept(AssemblyVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (serviceContract!=null) {
+ if (!serviceContract.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java
new file mode 100644
index 0000000000..e91245504b
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java
@@ -0,0 +1,80 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Property;
+
+/**
+ * An implementation of Property.
+ */
+public class PropertyImpl extends ExtensibleImpl implements Property {
+
+ private Object defaultValue;
+ private String name;
+ private boolean many;
+ private boolean required;
+ private Class<?> type;
+
+ protected PropertyImpl() {
+ }
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setDefaultValue(Object value) {
+ checkNotFrozen();
+ defaultValue = value;
+ }
+
+ public void setMany(boolean value) {
+ checkNotFrozen();
+ many = value;
+ }
+
+ public void setName(String value) {
+ checkNotFrozen();
+ name = value;
+ }
+
+ public void setRequired(boolean value) {
+ checkNotFrozen();
+ required = value;
+ }
+
+ public void setType(Class<?> value) {
+ checkNotFrozen();
+ type = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java
new file mode 100644
index 0000000000..1a064e5092
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Multiplicity;
+import org.apache.tuscany.model.assembly.Reference;
+
+/**
+ * An implementation of Reference.
+ */
+public class ReferenceImpl extends PortImpl implements Reference {
+
+ private Multiplicity multiplicity;
+
+ protected ReferenceImpl() {
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(Multiplicity multiplicity) {
+ checkNotFrozen();
+ this.multiplicity=multiplicity;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java
new file mode 100644
index 0000000000..f71702792b
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java
@@ -0,0 +1,60 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Scope;
+import org.apache.tuscany.model.assembly.ServiceContract;
+
+/**
+ * An implementation of ServiceContract.
+ */
+public class ServiceContractImpl extends ExtensibleImpl implements ServiceContract {
+
+ private Class interface_;
+ private Class callbackInterface;
+ private Scope scope;
+
+ protected ServiceContractImpl() {
+ }
+
+ public Class getCallbackInterface() {
+ return callbackInterface;
+ }
+
+ public Class getInterface() {
+ return interface_;
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+ public void setCallbackInterface(Class value) {
+ checkNotFrozen();
+ callbackInterface=value;
+ }
+
+ public void setInterface(Class value) {
+ checkNotFrozen();
+ interface_=value;
+ }
+
+ public void setScope(Scope scope) {
+ checkNotFrozen();
+ this.scope=scope;
+ }
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java
new file mode 100644
index 0000000000..d1432d0149
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java
@@ -0,0 +1,29 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Service;
+
+/**
+ * An implementation of Service.
+ */
+public class ServiceImpl extends PortImpl implements Service {
+
+ protected ServiceImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java
new file mode 100644
index 0000000000..ef180814ff
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java
@@ -0,0 +1,210 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.ConfiguredPort;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.Part;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceURI;
+
+/**
+ * An implementation of ServiceURI.
+ */
+public class ServiceURIImpl implements ServiceURI {
+
+ private String address;
+ private Boolean isSCAScheme;
+ private boolean isParsed;
+ private String moduleComponentName;
+ private String partName;
+ private String serviceName;
+
+ /**
+ * Constructs a new ServiceURIImpl.
+ * @param address
+ */
+ protected ServiceURIImpl(String address) {
+ this.address = address;
+ }
+
+ /**
+ * Constructs a new ServiceURIImpl.
+ * @param moduleComponent
+ * @param partName
+ * @param portName
+ */
+ protected ServiceURIImpl(ModuleComponent moduleComponent, String partName, String portName) {
+ if (moduleComponent != null)
+ moduleComponentName = moduleComponent.getName();
+ else
+ moduleComponentName = "";
+ this.partName = partName;
+ this.serviceName = portName;
+ }
+
+ /**
+ * Constructs a new ServiceURIImpl.
+ * @param moduleComponent
+ * @param configuredPort
+ */
+ protected ServiceURIImpl(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) {
+ if (moduleComponent != null)
+ moduleComponentName = moduleComponent.getName();
+ else
+ moduleComponentName = "";
+ if (configuredPort instanceof ConfiguredService) {
+ partName = part.getName();
+ ConfiguredService configuredService = (ConfiguredService) configuredPort;
+ Service service = configuredService.getPort();
+ if (service != null) {
+ serviceName = configuredService.getPort().getName();
+ address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName;
+ } else {
+ address = "sca:///" + moduleComponentName + '/' + partName;
+ }
+
+ } else if (configuredPort instanceof ConfiguredReference) {
+ ConfiguredReference configuredReference = (ConfiguredReference) configuredPort;
+ partName = part.getName();
+ serviceName = configuredReference.getPort().getName();
+ if (serviceName!=null)
+ address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName;
+ else
+ address = "sca:///" + moduleComponentName + '/' + partName;
+ }
+
+ isSCAScheme = Boolean.TRUE;
+ isParsed = true;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param moduleComponent
+ * @param targetServiceName
+ */
+ protected ServiceURIImpl(ModuleComponent moduleComponent, String targetServiceName) {
+ if (moduleComponent != null)
+ moduleComponentName = moduleComponent.getName();
+ else
+ moduleComponentName = "";
+ int s = targetServiceName.indexOf('/');
+ if (s == -1) {
+ partName = targetServiceName;
+ address = "sca:///" + moduleComponentName + '/' + partName;
+ } else {
+ partName = targetServiceName.substring(0, s);
+ this.serviceName = targetServiceName.substring(s + 1);
+ address = "sca:///" + moduleComponentName + '/' + partName + '/' + this.serviceName;
+ }
+ isSCAScheme = Boolean.TRUE;
+ isParsed = true;
+ }
+
+ public boolean isSCAScheme() {
+ if (isSCAScheme == null) {
+ if (address != null && address.startsWith("sca://")) {
+ isSCAScheme = Boolean.TRUE;
+ } else {
+ isSCAScheme = Boolean.FALSE;
+ }
+ }
+ return isSCAScheme.booleanValue();
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getPath() {
+ StringBuffer path = new StringBuffer();
+ String mc = getModuleComponentName();
+ if (mc != null) {
+ path.append(mc);
+ }
+ String p = getPartName();
+ if (p !=null) {
+ if (path.length()!=0)
+ path.append('/');
+ path.append(p);
+ }
+ String s = getServiceName();
+ if (s !=null) {
+ if (path.length()!=0)
+ path.append('/');
+ path.append(s);
+ }
+ return path.toString();
+ }
+
+ /**
+ * Parse the address.
+ */
+ private void parse() {
+ isParsed = true;
+ if (isSCAScheme()) {
+ int s1 = address.indexOf('/', 6);
+ if (s1 == -1)
+ return;
+ s1++;
+ int s2 = address.indexOf('/', s1);
+ if (s2 == -1)
+ return;
+ moduleComponentName = address.substring(s1, s2);
+ s2++;
+ int s3 = address.indexOf('/', s2);
+ if (s3 == -1) {
+ partName = address.substring(s2);
+ return;
+ }
+ partName = address.substring(s2, s3);
+ s3++;
+ serviceName = address.substring(s3);
+ }
+ }
+
+ /**
+ * Returns the module component name
+ */
+ public String getModuleComponentName() {
+ if (!isParsed)
+ parse();
+ return moduleComponentName;
+ }
+
+ /**
+ * Returns the part name
+ */
+ public String getPartName() {
+ if (!isParsed)
+ parse();
+ return partName;
+ }
+
+ /**
+ * Returns the service name
+ */
+ public String getServiceName() {
+ if (!isParsed)
+ parse();
+ return serviceName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java
new file mode 100644
index 0000000000..334e34ba5b
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.Subsystem;
+
+/**
+ * An implementation of Subsystem.
+ */
+public class SubsystemImpl extends CompositeImpl implements Subsystem {
+
+ private String uri;
+
+ protected SubsystemImpl() {
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String value) {
+ checkNotFrozen();
+ uri=value;
+ }
+
+ public ComponentType getComponentType() {
+ //TODO implement
+ return null;
+ }
+
+ public void setComponentType(ComponentType componentType) {
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java
new file mode 100644
index 0000000000..c7c4bda7a1
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.ServiceURI;
+import org.apache.tuscany.model.assembly.Wire;
+
+/**
+ * An implementation of Wire.
+ */
+public class WireImpl extends ExtensibleImpl implements Wire {
+
+ private ServiceURI source;
+ private ServiceURI target;
+
+ protected WireImpl() {
+ }
+
+ public ServiceURI getSource() {
+ return source;
+ }
+
+ public void setSource(ServiceURI uri) {
+ checkNotFrozen();
+ source=uri;
+ }
+
+ public ServiceURI getTarget() {
+ return target;
+ }
+
+ public void setTarget(ServiceURI uri) {
+ checkNotFrozen();
+ target=uri;
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java
new file mode 100644
index 0000000000..95793cc439
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.loader;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+
+/**
+ * An assembly model loader.
+ */
+public interface AssemblyModelLoader {
+
+ /**
+ * Load a WSDL definition
+ */
+ Definition loadDefinition(String uri);
+
+ /**
+ * Load definitions by namespace
+ */
+ List<Definition> loadDefinitions(String namespace);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java
new file mode 100644
index 0000000000..6c5e0ef75d
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.tuscany.model.scdl.loader.impl;
+
+import org.apache.tuscany.common.TuscanyRuntimeException;
+
+/**
+ * The root runtime exception for the model loader.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AssemblyModelLoadException extends TuscanyRuntimeException {
+ private static final long serialVersionUID = -5891723952359470362L;
+
+ public AssemblyModelLoadException() {
+ super();
+ }
+
+ public AssemblyModelLoadException(String message) {
+ super(message);
+ }
+
+ public AssemblyModelLoadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AssemblyModelLoadException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java
new file mode 100644
index 0000000000..8413350e50
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java
@@ -0,0 +1,71 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.scdl.loader.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+
+/**
+ */
+public class SCDLAssemblyModelLoaderImpl implements AssemblyModelLoader {
+ private WSDLReader wsdlReader;
+ private Map<String, Definition> definitions=new HashMap<String, Definition>();
+ private Map<String, List<Definition>> definitionsByNamespace=new HashMap<String, List<Definition>>();
+
+ public Definition loadDefinition(String uri) {
+ Definition definition=definitions.get(uri);
+ if (definition!=null)
+ return definition;
+
+ try {
+ if (wsdlReader==null) {
+ wsdlReader=WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose", false);
+ }
+ definition = wsdlReader.readWSDL(uri);
+ } catch (WSDLException e) {
+ throw new IllegalArgumentException(e);
+ }
+ if (definition==null)
+ throw new IllegalArgumentException("Could not load WSDL definition at "+uri);
+
+ definitions.put(uri, definition);
+
+ String namespace=definition.getTargetNamespace();
+ List<Definition> list=definitionsByNamespace.get(namespace);
+ if (list==null) {
+ list=new ArrayList<Definition>();
+ definitionsByNamespace.put(namespace, list);
+ }
+ list.add(definition);
+
+ return definition;
+ }
+
+ public List<Definition> loadDefinitions(String namespace) {
+ return definitionsByNamespace.get(namespace);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java
new file mode 100644
index 0000000000..68f9dfa6f8
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.types.java;
+
+import org.apache.tuscany.model.assembly.ServiceContract;
+
+
+/**
+ * Represents a Java service contract.
+ */
+public interface JavaServiceContract extends ServiceContract {
+
+ String getInterfaceName();
+
+ void setInterfaceName(String interfaceName);
+
+ String getCallbackInterfaceName();
+
+ void setCallbackInterfaceName(String callbackInterfaceName);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java
new file mode 100644
index 0000000000..d384bcd670
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java
@@ -0,0 +1,89 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.types.java.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.impl.ServiceContractImpl;
+import org.apache.tuscany.model.types.java.JavaServiceContract;
+
+/**
+ * An implementation of JavaServiceContract.
+ */
+public class JavaServiceContractImpl extends ServiceContractImpl implements JavaServiceContract {
+
+ private String interfaceName;
+ private String callbackInterfaceName;
+
+ /**
+ * Constructor
+ */
+ public JavaServiceContractImpl() {
+ }
+
+ /**
+ * @param interfaceName The interfaceName to set.
+ */
+ public void setInterfaceName(String interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
+ /**
+ * @param callbackInterfaceName The callbackInterfaceName to set.
+ */
+ public void setCallbackInterfaceName(String callbackInterfaceName) {
+ this.callbackInterfaceName = callbackInterfaceName;
+ }
+
+ public String getInterfaceName() {
+ return interfaceName;
+ }
+
+ public String getCallbackInterfaceName() {
+ return callbackInterfaceName;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext)
+ */
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+
+ // Load the interface
+ if (getInterface()==null && interfaceName!=null) {
+ try {
+ Class<?> interfaceClass=modelContext.getApplicationResourceLoader().loadClass(interfaceName);
+ setInterface(interfaceClass);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ // Load the callback interface
+ if (getCallbackInterface()==null && callbackInterfaceName!=null) {
+ try {
+ Class<?> callbackInterfaceClass=modelContext.getApplicationResourceLoader().loadClass(callbackInterfaceName);
+ setInterface(callbackInterfaceClass);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ super.initialize(modelContext);
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java
new file mode 100644
index 0000000000..999242a4c2
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.types.wsdl;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.model.assembly.ServiceContract;
+
+/**
+ * A WSDL service contract.
+ */
+public interface WSDLServiceContract extends ServiceContract {
+
+ /**
+ * Returns the WSDL portType.
+ * @return the WSDL portType
+ */
+ PortType getPortType();
+
+ /**
+ * Sets the WSDL portType.
+ * @param portType
+ */
+ void setPortType(PortType portType);
+
+ /**
+ * Returns the callback WSDL portType.
+ * @return the callback WSDL portType
+ */
+ PortType getCallbackPortType();
+
+ /**
+ * Sets the callback WSDL portType.
+ * @param portType
+ */
+ void setCallbackPortType(PortType portType);
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java
new file mode 100644
index 0000000000..a596eb539f
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java
@@ -0,0 +1,234 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.types.wsdl.impl;
+
+import static org.objectweb.asm.Opcodes.ACC_ABSTRACT;
+import static org.objectweb.asm.Opcodes.ACC_INTERFACE;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.V1_5;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.impl.ServiceContractImpl;
+import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
+import org.apache.tuscany.model.util.XMLNameUtil;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Type;
+
+import commonj.sdo.Property;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * An implementation of WSDLServiceContract.
+ */
+public class WSDLServiceContractImpl extends ServiceContractImpl implements WSDLServiceContract {
+
+ private PortType portType;
+
+ private PortType callbackPortType;
+
+ private static final String[] EMPTY_STRINGS = new String[0];
+
+ /**
+ * Constructor
+ */
+ public WSDLServiceContractImpl() {
+ }
+
+ public PortType getPortType() {
+ return portType;
+ }
+
+ public void setPortType(PortType portType) {
+ checkNotFrozen();
+ this.portType = portType;
+ }
+
+ public PortType getCallbackPortType() {
+ return callbackPortType;
+ }
+
+ public void setCallbackPortType(PortType portType) {
+ checkNotFrozen();
+ callbackPortType = portType;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext)
+ */
+ public void initialize(AssemblyContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Load the Java interface for the portType
+ if (portType != null && getInterface() == null) {
+ QName qname = portType.getQName();
+ String interfaceName = XMLNameUtil.getFullyQualifiedClassNameFromQName(qname.getNamespaceURI(), qname.getLocalPart());
+ Class<?> interfaceClass;
+ try {
+ // Load the interface
+ interfaceClass = modelContext.getApplicationResourceLoader().loadClass(interfaceName);
+ } catch (ClassNotFoundException e) {
+ // Generate the interface on the fly
+ interfaceClass = generateJavaInterface(modelContext.getTypeHelper(), modelContext.getApplicationResourceLoader(), portType, interfaceName);
+ }
+ super.setInterface(interfaceClass);
+ }
+
+ // Load the Java interface for the callback portType
+ if (callbackPortType != null && getCallbackInterface() == null) {
+ QName qname = callbackPortType.getQName();
+ String interfaceName = XMLNameUtil.getFullyQualifiedClassNameFromQName(qname.getNamespaceURI(), qname.getLocalPart());
+ Class<?> interfaceClass;
+ try {
+ // Load the interface
+ interfaceClass = modelContext.getApplicationResourceLoader().loadClass(interfaceName);
+ } catch (ClassNotFoundException e) {
+ // Generate the interface on the fly
+ interfaceClass = generateJavaInterface(modelContext.getTypeHelper(), modelContext.getApplicationResourceLoader(), portType, interfaceName);
+ }
+ super.setCallbackInterface(interfaceClass);
+ }
+ }
+
+ /**
+ * Generate a Java interface from a WSDL portType.
+ *
+ * @param portType
+ * @param interfaceName
+ * @return a Java interface that provides the same service contract as the WSDL portType
+ */
+ @SuppressWarnings("unchecked")
+ private static Class<?> generateJavaInterface(TypeHelper typeHelper, ResourceLoader resourceLoader, PortType portType, String interfaceName) {
+
+ ClassLoader cl=Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
+
+ // Create an XSD helper
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+
+ ClassWriter cw = new ClassWriter(false);
+
+ // Generate the interface
+ interfaceName = interfaceName.replace('.', '/');
+ cw.visit(V1_5, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, interfaceName, null, "java/lang/Object", EMPTY_STRINGS);
+
+ // Generate methods from the WSDL operations
+ for (Operation operation : (List<Operation>) portType.getOperations()) {
+
+ //FIXME Workaround for TUSCANY-170, we will need to make this consistent with the algorithm used by Axis2 WSDL2Java
+ // to generate method names from operations names
+ //String methodName = XMLNameUtil.getJavaNameFromXMLName(operation.getName(), false);
+ String methodName = operation.getName();
+
+ // FIXME later we may want to wwitch to use the Axis2 WSDL2Java (not to generate the Java source,
+ // just to figure the WSDL to Java mapping)
+
+ // Derive the method signature from the input message part (and check if it's a doc-wrapped or doc-bare operation)
+ List<Class> inputTypes=new ArrayList<Class>();
+ boolean wrapped = false;
+ if (operation.getInput() != null && operation.getInput().getMessage()!=null && !operation.getInput().getMessage().getParts().isEmpty()) {
+ QName qname=((Part)operation.getInput().getMessage().getParts().values().iterator().next()).getElementName();
+ if (qname!=null) {
+ Property property = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true);
+ commonj.sdo.Type type = property.getType();
+ if (property.getName().equals(operation.getName())) {
+ String localName = xsdHelper.getLocalName(type);
+ if (localName.indexOf("_._")!=-1) {
+ for (Property param : (List<Property>)type.getProperties()) {
+ Class inputType = param.getType().getInstanceClass();
+ if (inputType == null)
+ inputType = Object.class;
+ inputTypes.add(inputType);
+ }
+ wrapped=true;
+ }
+ }
+
+ // Bare doc style
+ if (!wrapped) {
+ Class inputType = type.getInstanceClass();
+ if (inputType == null)
+ inputType = Object.class;
+ inputTypes.add(inputType);
+ }
+
+ } else {
+ // FIXME only support elements for now
+ }
+ }
+
+ // Derive the return type from the output message part (also support doc-wrapped and doc-bare here)
+ Class outputType=Void.class;
+ if (operation.getOutput() != null && operation.getOutput().getMessage()!=null && !operation.getOutput().getMessage().getParts().isEmpty()) {
+ QName qname=((Part)operation.getOutput().getMessage().getParts().values().iterator().next()).getElementName();
+ if (qname!=null) {
+ Property property = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true);
+ commonj.sdo.Type type = property.getType();
+ if (wrapped) {
+ if (!type.getProperties().isEmpty()) {
+ outputType=((Property)type.getProperties().get(0)).getType().getInstanceClass();
+ if (outputType==null)
+ outputType=Object.class;
+ }
+ } else {
+ outputType = type.getInstanceClass();
+ if (outputType==null)
+ outputType=Object.class;
+ }
+ } else {
+ // FIXME only support elements for now
+ }
+ }
+
+ // FIXME integrate XSD to Java type mapping here
+ StringBuffer inputSignature=new StringBuffer();
+ for (Class inputType : inputTypes) {
+ inputSignature.append(Type.getDescriptor(inputType));
+ }
+ String outputSignature = Type.getDescriptor(outputType);
+
+ cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, methodName, '(' + inputSignature.toString() + ')' + outputSignature, null, null).visitEnd();
+ }
+
+ // Generate the bytecodes
+ cw.visitEnd();
+ byte[] bytes = cw.toByteArray();
+
+ // Add the class to the resource loader
+
+ return resourceLoader.addClass(bytes);
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java
new file mode 100644
index 0000000000..1f064e0977
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java
@@ -0,0 +1,108 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * A list that invokes added or removed methods when elements are added or removed.
+ *
+ */
+public abstract class NotifyingList<E> extends ArrayList<E> {
+
+ private boolean frozen;
+
+ public NotifyingList() {
+ }
+
+ public void freeze() {
+ frozen=true;
+ }
+
+ protected void checkNotFrozen() {
+ if (frozen)
+ throw new IllegalStateException("Attempt to modify a frozen list");
+ }
+
+ public boolean add(E element) {
+ checkNotFrozen();
+ boolean result=super.add(element);
+ added(element);
+ return result;
+ }
+
+ public void add(int index, E element) {
+ checkNotFrozen();
+ super.add(index, element);
+ added(element);
+ }
+
+ public boolean addAll(Collection<? extends E> c) {
+ checkNotFrozen();
+ boolean result=super.addAll(c);
+ for (E element : c)
+ added(element);
+ return result;
+ }
+
+ public boolean addAll(int index, Collection<? extends E> c) {
+ checkNotFrozen();
+ boolean result=super.addAll(index, c);
+ for (E element : c)
+ added(element);
+ return result;
+ }
+
+ public void clear() {
+ checkNotFrozen();
+ List<E> l=new ArrayList<E>(this);
+ super.clear();
+ for (E element : l)
+ removed(element);
+ }
+
+ public E remove(int index) {
+ checkNotFrozen();
+ E element=super.remove(index);
+ removed(element);
+ return element;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean remove(Object element) {
+ checkNotFrozen();
+ boolean result=super.remove(element);
+ removed((E)element);
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean removeAll(Collection<?> c) {
+ checkNotFrozen();
+ boolean result=super.removeAll(c);
+ for (E element : (Collection<? extends E>)c)
+ removed(element);
+ return result;
+ }
+
+ protected abstract void added(E element);
+
+ protected abstract void removed(E element);
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java
new file mode 100644
index 0000000000..f493356594
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java
@@ -0,0 +1,212 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.util;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder;
+
+
+
+/**
+ * A utility class that converts between XML names and Java names.
+ */
+public final class XMLNameUtil {
+
+ private static final List<String> DOMAINS = Arrays.asList(new String[]{"COM", "com", "ORG", "org"});
+
+ /**
+ * Constructor
+ */
+ private XMLNameUtil() {
+ super();
+ }
+
+ /**
+ * Return an EPackage name for the given namespace.
+ *
+ * @param namespace
+ * @return an EPackage name for the given namespace
+ */
+ public static String getPackageNameFromNamespace(String namespace) {
+ return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace);
+ }
+
+ /**
+ * Trim the file extension from a path.
+ * @param path
+ * @return
+ */
+ private static String trimFileExtension(String path) {
+ int s=path.lastIndexOf('/');
+ int d=path.lastIndexOf('.');
+ if (d>s) {
+ return path.substring(0,d);
+ } else {
+ return path;
+ }
+ }
+
+ /**
+ * Returns a namespace prefix for the given package Name.
+ *
+ * @param packageName
+ * @return a namespace prefix for the given package Name
+ */
+ public static String getNSPrefixFromPackageName(String packageName) {
+ int index = packageName.lastIndexOf('.');
+ return index == -1 ? packageName : packageName.substring(index + 1);
+ }
+
+ /**
+ * Parse the given name.
+ *
+ * @param sourceName
+ * @param separator
+ * @return some stuff parsed from the name
+ */
+ private static List<String> parseName(String sourceName, char separator) {
+ List<String> result = new ArrayList<String>();
+ if (sourceName != null) {
+ StringBuilder currentWord = new StringBuilder(64);
+ boolean lastIsLower = false;
+ int index;
+ int length;
+ for (index = 0, length = sourceName.length(); index < length; ++index) {
+ char curChar = sourceName.charAt(index);
+ if (!Character.isJavaIdentifierPart(curChar)) {
+ curChar = separator;
+ }
+ if (Character.isUpperCase(curChar)
+ || (!lastIsLower && Character.isDigit(curChar))
+ || curChar == separator) {
+
+ if (lastIsLower && currentWord.length() > 1
+ || curChar == separator && currentWord.length() > 0) {
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder(64);
+ }
+ lastIsLower = false;
+ } else {
+ if (!lastIsLower) {
+ int currentWordLength = currentWord.length();
+ if (currentWordLength > 1) {
+ char lastChar = currentWord.charAt(--currentWordLength);
+ currentWord.setLength(currentWordLength);
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder(64);
+ currentWord.append(lastChar);
+ }
+ }
+ lastIsLower = true;
+ }
+
+ if (curChar != separator) {
+ currentWord.append(curChar);
+ }
+ }
+
+ result.add(currentWord.toString());
+ }
+ return result;
+ }
+
+ /**
+ * Returns a valid Java name from an XML Name.
+ *
+ * @param name
+ * @param isUpperCase
+ * @return a valid Java name from an XML Name
+ */
+ public static String getJavaNameFromXMLName(String name, boolean isUpperCase) {
+ List<String> parsedName = parseName(name, '_');
+ StringBuilder result = new StringBuilder(64 * parsedName.size());
+ for (String nameComponent: parsedName) {
+ if (nameComponent.length() > 0) {
+ if (result.length() > 0 || isUpperCase) {
+ result.append(Character.toUpperCase(nameComponent.charAt(0)));
+ result.append(nameComponent.substring(1));
+ } else {
+ result.append(nameComponent);
+ }
+ }
+ }
+
+ if (result.length() == 0) {
+ return "_";
+ }
+ if (Character.isJavaIdentifierStart(result.charAt(0))) {
+ return isUpperCase ? result.toString() : decapitalizeName(result.toString());
+ }
+ return "_" + result;
+ }
+
+ /**
+ * Returns a valid fully qualified class name from a QName.
+ * @param namespace
+ * @param name
+ * @return a valid fully qualified class name from a QName
+ */
+ public static String getFullyQualifiedClassNameFromQName(String namespace, String name) {
+ return XMLNameUtil.getPackageNameFromNamespace(namespace) + '.'
+ + XMLNameUtil.getJavaNameFromXMLName(name, true);
+ }
+
+ /**
+ * Decapitalize a name.
+ * @param name
+ * @return a decapitalized name
+ */
+ public static String decapitalizeName(String name) {
+ if (name.length() == 0) {
+ return name;
+ } else {
+ String lowerName = name.toLowerCase();
+ int i;
+ for (i = 0; i < name.length(); i++) {
+ if (name.charAt(i) == lowerName.charAt(i)) {
+ break;
+ }
+ }
+ if (i > 1 && i < name.length()) {
+ --i;
+ }
+ return name.substring(0, i).toLowerCase() + name.substring(i);
+ }
+ }
+
+ /**
+ * Capitalize a name.
+ * @param name
+ * @return a capitalized name
+ */
+ public static String capitalizeName(String name) {
+ int l = name.length();
+ if (l == 0) {
+ return name;
+ } else if (l == 1) {
+ return name.toUpperCase();
+ } else {
+ return name.substring(0, 1).toUpperCase() + name.substring(1);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..25d78feeac
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,1277 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+APACHE TUSCANY SUBCOMPONENTS:
+
+The Apache Tuscany distribution includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+For the Eclipse Modeling Framework component and the Celtix binding:
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+
+For the Rhino JavaScript container component:
+
+Mozilla Public License 1.1 (MPL 1.1)
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original Code,
+prior Modifications used by a Contributor, and the Modifications made by that
+particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+combination of the Original Code and Modifications, in each case including
+portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+accepted in the software development community for the electronic transfer of
+data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified as
+the Initial Developer in the Source Code notice required by Exhibit A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+extent possible, whether at the time of the initial grant or subsequently
+acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+substance or structure of either the Original Code or any previous
+Modifications. When Covered Code is released as a series of files, a
+Modification is:
+ A. Any addition to or deletion from the contents of a file
+containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+which is described in the Source Code notice required by Exhibit A as Original
+Code, and which, at the time of its release under this License is not already
+Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+hereafter acquired, including without limitation, method, process, and
+apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+making modifications to it, including all modules it contains, plus any
+associated interface definition files, scripts used to control compilation and
+installation of an Executable, or source code differential comparisons against
+either the Original Code or another well known, available Covered Code of the
+Contributor's choice. The Source Code can be in a compressed or archival form,
+provided the appropriate decompression or de-archiving software is widely
+available for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+exercising rights under, and complying with all of the terms of, this License
+or a future version of this License issued under Section 6.1. For legal
+entities, "You" includes any entity which controls, is controlled by, or is
+under common control with You. For purposes of this definition, "control"
+means (a) the power, direct or indirect, to cause the direction or management
+of such entity, whether by contract or otherwise, or (b) ownership of more
+than fifty percent (50%) of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+non-exclusive license, subject to third party intellectual property claims:
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Initial Developer to use, reproduce, modify, display,
+perform, sublicense and distribute the Original Code (or portions thereof)
+with or without Modifications, and/or as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or selling
+of Original Code, to make, have made, use, practice, sell, and offer for sale,
+and/or otherwise dispose of the Original Code (or portions thereof).
+ (c) the licenses granted in this Section 2.1(a) and
+(b) are effective on the date Initial Developer first distributes Original
+Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+granted: 1) for code that You delete from the Original Code; 2) separate from
+the Original Code; or 3) for infringements caused by: i) the modification of
+the Original Code or ii) the combination of the Original Code with other
+software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+trademark) Licensable by Contributor, to use, reproduce, modify, display,
+perform, sublicense and distribute the Modifications created by such
+Contributor (or portions thereof) either on an unmodified basis, with other
+Modifications, as Covered Code and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or selling
+of Modifications made by that Contributor either alone and/or in combination
+with its Contributor Version (or portions of such combination), to make, use,
+sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications
+made by that Contributor (or portions thereof); and 2) the combination of
+Modifications made by that Contributor with its Contributor Version (or
+portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+effective on the date Contributor first makes Commercial Use of the Covered
+Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+granted: 1) for any code that Contributor has deleted from the Contributor
+Version; 2) separate from the Contributor Version; 3) for infringements
+caused by: i) third party modifications of Contributor Version or ii) the
+combination of Modifications made by that Contributor with other software
+(except as part of the Contributor Version) or other devices; or 4) under
+Patent Claims infringed by Covered Code in the absence of Modifications made
+by that Contributor.
+
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+governed by the terms of this License, including without limitation Section
+2.2. The Source Code version of Covered Code may be distributed only under the
+terms of this License or a future version of this License released under
+Section 6.1, and You must include a copy of this License with every copy of
+the Source Code You distribute. You may not offer or impose any terms on any
+Source Code version that alters or restricts the applicable version of this
+License or the recipients' rights hereunder. However, You may include an
+additional document offering the additional rights described in Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+made available in Source Code form under the terms of this License either on
+the same media as an Executable version or via an accepted Electronic
+Distribution Mechanism to anyone to whom you made an Executable version
+available; and if made available via Electronic Distribution Mechanism, must
+remain available for at least twelve (12) months after the date it initially
+became available, or at least six (6) months after a subsequent version of
+that particular Modification has been made available to such recipients. You
+are responsible for ensuring that the Source Code version remains available
+even if the Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+file documenting the changes You made to create that Covered Code and the date
+of any change. You must include a prominent statement that the Modification is
+derived, directly or indirectly, from Original Code provided by the Initial
+Developer and including the name of the Initial Developer in (a) the Source
+Code, and (b) in any notice in an Executable version or related documentation
+in which You describe the origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+intellectual property rights is required to exercise the rights granted by
+such Contributor under Sections 2.1 or 2.2, Contributor must include a text
+file with the Source Code distribution titled "LEGAL" which describes the
+claim and the party making the claim in sufficient detail that a recipient
+will know whom to contact. If Contributor obtains such knowledge after the
+Modification is made available as described in Section 3.2, Contributor shall
+promptly modify the LEGAL file in all copies Contributor makes available
+thereafter and shall take other steps (such as notifying appropriate mailing
+lists or newsgroups) reasonably calculated to inform those who received the
+Covered Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+interface and Contributor has knowledge of patent licenses which are
+reasonably necessary to implement that API, Contributor must also include this
+information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+Section 3.4(a) above, Contributor believes that Contributor's Modifications
+are Contributor's original creation(s) and/or Contributor has sufficient
+rights to grant the rights conveyed by this License.
+
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+Code. If it is not possible to put such notice in a particular Source Code
+file due to its structure, then You must include such notice in a location
+(such as a relevant directory) where a user would be likely to look for such a
+notice. If You created one or more Modification(s) You may add your name as a
+Contributor to the notice described in Exhibit A. You must also duplicate
+this License in any documentation for the Source Code where You describe
+recipients' rights or ownership rights relating to Covered Code. You may
+choose to offer, and to charge a fee for, warranty, support, indemnity or
+liability obligations to one or more recipients of Covered Code. However, You
+may do so only on Your own behalf, and not on behalf of the Initial Developer
+or any Contributor. You must make it absolutely clear than any such warranty,
+support, indemnity or liability obligation is offered by You alone, and You
+hereby agree to indemnify the Initial Developer and every Contributor for any
+liability incurred by the Initial Developer or such Contributor as a result of
+warranty, support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+requirements of Section 3.1-3.5 have been met for that Covered Code, and if
+You include a notice stating that the Source Code version of the Covered Code
+is available under the terms of this License, including a description of how
+and where You have fulfilled the obligations of Section 3.2. The notice must
+be conspicuously included in any notice in an Executable version, related
+documentation or collateral in which You describe recipients' rights relating
+to the Covered Code. You may distribute the Executable version of Covered Code
+or ownership rights under a license of Your choice, which may contain terms
+different from this License, provided that You are in compliance with the
+terms of this License and that the license for the Executable version does not
+attempt to limit or alter the recipient's rights in the Source Code version
+from the rights set forth in this License. If You distribute the Executable
+version under a different license You must make it absolutely clear that any
+terms which differ from this License are offered by You alone, not by the
+Initial Developer or any Contributor. You hereby agree to indemnify the
+Initial Developer and every Contributor for any liability incurred by the
+Initial Developer or such Contributor as a result of any such terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+not governed by the terms of this License and distribute the Larger Work as a
+single product. In such a case, You must make sure the requirements of this
+License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Code due to statute,
+judicial order, or regulation then You must: (a) comply with the terms of this
+License to the maximum extent possible; and (b) describe the limitations and
+the code they affect. Such description must be included in the LEGAL file
+described in Section 3.4 and must be included with all distributions of the
+Source Code. Except to the extent prohibited by statute or regulation, such
+description must be sufficiently detailed for a recipient of ordinary skill to
+be able to understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has attached
+the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+and/or new versions of the License from time to time. Each version will be
+given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+License, You may always continue to use it under the terms of that version.
+You may also choose to use such Covered Code under the terms of any subsequent
+version of the License published by Netscape. No one other than Netscape has
+the right to modify the terms applicable to Covered Code created under this
+License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+only do in order to apply it to code which is not already Covered Code
+governed by this License), You must (a) rename Your license so that the
+phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or
+any confusingly similar phrase do not appear in your license (except to note
+that your license differs from this License) and (b) otherwise make it clear
+that Your version of the license contains terms which differ from the Mozilla
+Public License and Netscape Public License. (Filling in the name of the
+Initial Developer, Original Code or Contributor in the notice described in
+Exhibit A shall not of themselves be deemed to be modifications of this
+License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE,
+FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE
+QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED
+CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
+OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR
+CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+automatically if You fail to comply with terms herein and fail to cure such
+breach within 30 days of becoming aware of the breach. All sublicenses to the
+Covered Code which are properly granted shall survive any termination of this
+License. Provisions which, by their nature, must remain in effect beyond the
+termination of this License shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+claim (excluding declatory judgment actions) against Initial Developer or a
+Contributor (the Initial Developer or Contributor against whom You file such
+action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+infringes any patent, then any and all rights granted by such Participant to
+You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
+from Participant terminate prospectively, unless if within 60 days after
+receipt of notice You either: (i) agree in writing to pay Participant a
+mutually agreeable reasonable royalty for Your past and future use of
+Modifications made by such Participant, or (ii) withdraw Your litigation claim
+with respect to the Contributor Version against such Participant. If within
+60 days of notice, a reasonable royalty and payment arrangement are not
+mutually agreed upon in writing by the parties or the litigation claim is not
+withdrawn, the rights granted by Participant to You under Sections 2.1 and/or
+2.2 automatically terminate at the expiration of the 60 day notice period
+specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+Contributor Version, directly or indirectly infringes any patent, then any
+rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are
+revoked effective as of the date You first made, used, sold, distributed, or
+had made, Modifications made by that Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+alleging that such Participant's Contributor Version directly or indirectly
+infringes any patent where such claim is resolved (such as by license or
+settlement) prior to the initiation of patent infringement litigation, then
+the reasonable value of the licenses granted by such Participant under
+Sections 2.1 or 2.2 shall be taken into account in determining the amount or
+value of any payment or license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above, all
+end user license agreements (excluding distributors and resellers) which have
+been validly granted by You or any distributor hereunder prior to termination
+shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY
+SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING,
+WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
+FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES,
+EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH
+DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH
+OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS
+EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in 48
+C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and
+"commercial computer software documentation," as such terms are used in 48
+C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R.
+227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users
+acquire Covered Code with only those rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject matter
+hereof. If any provision of this License is held to be unenforceable, such
+provision shall be reformed only to the extent necessary to make it
+enforceable. This License shall be governed by California law provisions
+(except to the extent applicable law, if any, provides otherwise), excluding
+its conflict-of-law provisions. With respect to disputes in which at least one
+party is a citizen of, or an entity chartered or registered to do business in
+the United States of America, any litigation relating to this License shall be
+subject to the jurisdiction of the Federal Courts of the Northern District of
+California, with venue lying in Santa Clara County, California, with the
+losing party responsible for costs, including without limitation, court costs
+and reasonable attorneys' fees and expenses. The application of the United
+Nations Convention on Contracts for the International Sale of Goods is
+expressly excluded. Any law or regulation which provides that the language of
+a contract shall be construed against the drafter shall not apply to this
+License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or indirectly, out of its
+utilization of rights under this License and You agree to work with Initial
+Developer and Contributors to distribute such responsibility on an equitable
+basis. Nothing herein is intended or shall be deemed to constitute any
+admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits
+you to utilize portions of the Covered Code under Your choice of the MPL or
+the alternative licenses, if any, specified by the Initial Developer in the
+file described in Exhibit A.
+
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+Version 1.1 (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.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF
+ ANY KIND, either express or implied. See the License for the specific
+language governing rights and
+ limitations under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+Portions created by
+ ______________________ are Copyright (C) ______
+_______________________. All Rights
+ Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms of
+the _____ license (the [___] License), in which case the provisions of
+[______] License are applicable instead of those above. If you wish to allow
+use of your version of this file only under the terms of the [____] License
+and not to allow others to use your version of this file under the MPL,
+indicate your decision by deleting the provisions above and replace them
+with the notice and other provisions required by the [___] License. If you do
+not delete the provisions above, a recipient may use your version of this file
+under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+the notices in the Source Code files of the Original Code. You should use the
+text of this Exhibit A rather than the text found in the Original Code Source
+Code for Your Modifications.]
+
+
+===============================================================================
+
+For the JAX-WS Reference Implementation component:
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients'
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient's rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R.
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction's conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys' fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
+
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d48810c0ec
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,18 @@
+=========================================================================
+== NOTICE file corresponding to the section 4 d of ==
+== the Apache License, Version 2.0, ==
+== in this case for the Apache Tuscany distribution. ==
+=========================================================================
+
+This product includes software developed by the Apache Software Foundation
+(http://www.apache.org/).
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Celtix project (http://celtix.objectweb.org/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/)
+
+Please read the LICENSE.txt file present in the root directory of this
+distribution.
+
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd
new file mode 100644
index 0000000000..3b003ce77a
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdo="commonj.sdo/xml"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.sca" type="sca:SCABinding" substitutionGroup="sca:binding" sdo:name="bindingSca"/>
+ <complexType name="SCABinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..79131506c4
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdo="commonj.sdo/xml"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding" sdo:name="bindingWs"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="port" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd
new file mode 100644
index 0000000000..7d3ca73676
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdo="commonj.sdo/xml"
+ xmlns:sdojava="commonj.sdo/java"
+ sdojava:package="org.apache.tuscany.model.scdl"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="interface" type="sca:Interface"/>
+ <complexType name="Interface"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Property">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="required" sdo:name="dataType"/>
+ <attribute name="many" type="boolean" default="false" use="optional"/>
+ <attribute name="required" type="boolean" default="false" use="optional"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <element name="moduleFragment" type="sca:ModuleFragment"/>
+ <complexType name="ModuleFragment">
+ <sequence>
+ <!-- This is a Tuscany extension -->
+ <element minOccurs="0" maxOccurs="unbounded" name="import" type="sca:Import"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="module" type="sca:Module"/>
+ <complexType name="Module">
+ <complexContent>
+ <extension base="sca:ModuleFragment"/>
+ </complexContent>
+ </complexType>
+
+ <complexType name="EntryPoint">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/>
+ <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..n sample
+ <reference>StockQuoteComponent</reference> - type must be URI
+ a multiplicity 1..n or 0..n sample
+ <reference>StockQuoteComponent1</reference> - type must be URI
+ <reference>StockQuoteComponent2</reference>
+ -->
+
+ <element name="binding" type="sca:Binding"/>
+ <complexType name="Binding">
+ <attribute name="uri" type="anyURI" use="optional"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..1 sample
+ <references>
+ <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI
+ </references>
+ a multiplicity 1..n or 0..n sample
+ <references>
+ <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI
+ <v:stockQuote>StockQuoteComponent2</v:stockQuote>
+ </references>
+ -->
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+ <complexType name="PropertyValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ReferenceValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ExternalService">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ModuleWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="source" type="anyType"/>
+ <element name="target" type="anyType"/>
+
+ <element name="source.uri" type="anyURI" substitutionGroup="sca:source" sdo:name="sourceUri"/>
+ <element name="target.uri" type="anyURI" substitutionGroup="sca:target" sdo:name="targetUri"/>
+
+ <element name="subsystem" type="sca:Subsystem"/>
+ <complexType name="Subsystem">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ModuleComponent">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="SystemWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="source.epr" type="anyType" substitutionGroup="sca:source" sdo:name="sourceEpr"/>
+ <element name="target.epr" type="anyType" substitutionGroup="sca:target" sdo:name="targetEpr"/>
+
+ <simpleType name="Multiplicity">
+ <restriction base="string">
+ <enumeration value="0..1" sdo:name="_01"/>
+ <enumeration value="1..1" sdo:name="_11"/>
+ <enumeration value="0..n" sdo:name="_0n"/>
+ <enumeration value="1..n" sdo:name="_1n"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="OverrideOptions">
+ <restriction base="string">
+ <enumeration value="no"/>
+ <enumeration value="may"/>
+ <enumeration value="must"/>
+ </restriction>
+ </simpleType>
+
+ <!-- This is a Tuscany extension -->
+ <element name="import" type="sca:Import"/>
+ <complexType name="Import"/>
+
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd
new file mode 100644
index 0000000000..d7998a355c
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdo="commonj.sdo/xml"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.java" type="sca:JavaImplementation" substitutionGroup="sca:implementation" sdo:name="implementationJava"/>
+ <complexType name="JavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd
new file mode 100644
index 0000000000..2b3f263b52
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdo="commonj.sdo/xml"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface" sdo:name="interfaceJava"/>
+ <complexType name="JavaInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="NCName" use="required"/>
+ <attribute name="callbackInterface" type="NCName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..3649f4d898
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdo="commonj.sdo/xml"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface" sdo:name="interfaceWsdl"/>
+ <complexType name="WSDLPortType">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="anyURI" use="required"/>
+ <attribute name="callbackInterface" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- This is a Tuscany extension -->
+ <element name="import.wsdl" type="sca:WSDLImport" substitutionGroup="sca:import" sdo:name="importWsdl"/>
+ <complexType name="WSDLImport">
+ <complexContent>
+ <extension base="sca:Import">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="namespace" type="anyURI" use="optional"/>
+ <attribute name="location" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- This is a Tuscany extension -->
+ <element name="import.sdo" type="sca:SDOImport" substitutionGroup="sca:import" sdo:name="importSdo"/>
+ <complexType name="SDOImport">
+ <complexContent>
+ <extension base="sca:Import">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="optional"/>
+ <attribute name="factory" type="NCName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd
new file mode 100644
index 0000000000..d49dfeff79
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sdojava="commonj.sdo/java"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ sdojava:package="org.apache.tuscany.model.scdl">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <include schemaLocation="sca-interface-java.xsd"/>
+ <include schemaLocation="sca-interface-wsdl.xsd"/>
+
+ <include schemaLocation="sca-implementation-java.xsd"/>
+
+ <include schemaLocation="sca-binding-webservice.xsd"/>
+ <include schemaLocation="sca-binding-sca.xsd"/>
+
+</schema>
diff --git a/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties
new file mode 100644
index 0000000000..4581e44bff
--- /dev/null
+++ b/sca-java-1.x/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties
@@ -0,0 +1,25 @@
+# Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+
+# =====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# =====================================================================
+# NLS_MESSAGEFORMAT_ALL