diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:11:48 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:11:48 +0000 |
commit | ece4fd35da7b7fc76264776f81705e6b5b52d3e0 (patch) | |
tree | 962794e2a2b1ab91a02c41e4927a527cade83959 /branches/java-post-M1/sca/model/src/main/java/org | |
parent | 76e9f96ca7f494088fe3af5a46ad0d153e961008 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835140 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/java-post-M1/sca/model/src/main/java/org')
78 files changed, 0 insertions, 5795 deletions
diff --git a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java deleted file mode 100644 index e167882786..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java deleted file mode 100644 index 48aed5f35a..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java deleted file mode 100644 index efbc6bffa4..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java +++ /dev/null @@ -1,260 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java deleted file mode 100644 index 69a7854df9..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java deleted file mode 100644 index d25f114902..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java deleted file mode 100644 index f153b9b4f6..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java deleted file mode 100644 index 0c98bbbe95..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java deleted file mode 100644 index 4d0703186b..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java deleted file mode 100644 index 51becc29c2..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java deleted file mode 100644 index b8d566f1d6..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java deleted file mode 100644 index 58ac9bc9de..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java deleted file mode 100644 index 09f51945bb..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java deleted file mode 100644 index c78fe28ff5..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java deleted file mode 100644 index 7f562e99d9..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java deleted file mode 100644 index 0d3a3e5011..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java deleted file mode 100644 index 22cb734869..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java deleted file mode 100644 index 696250ea44..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java deleted file mode 100644 index 20259f245d..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java deleted file mode 100644 index a90b89c4f5..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java deleted file mode 100644 index b4651a6186..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java deleted file mode 100644 index f2b72ec928..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java deleted file mode 100644 index 2777d985f8..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java deleted file mode 100644 index 7c858a1b76..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java deleted file mode 100644 index 40d1d1534b..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java deleted file mode 100644 index 00f6079096..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java deleted file mode 100644 index dec1e8bfd3..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java deleted file mode 100644 index c51ab7b8ea..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java deleted file mode 100644 index 68489d0200..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java deleted file mode 100644 index 9645ad6d35..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java deleted file mode 100644 index 13b9d0a1db..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java deleted file mode 100644 index 1f238efce6..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java deleted file mode 100644 index 055448b2f5..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java deleted file mode 100644 index 8cc13e98ec..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java deleted file mode 100644 index c7194292f0..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java deleted file mode 100644 index c73002efba..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java deleted file mode 100644 index 1600e11663..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java deleted file mode 100644 index 740febc360..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java deleted file mode 100644 index 709ba4da35..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java deleted file mode 100644 index dfe553210a..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java deleted file mode 100644 index a7f9012db7..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java deleted file mode 100644 index c88ea4448f..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java +++ /dev/null @@ -1,217 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java deleted file mode 100644 index 38056e1e1c..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java deleted file mode 100644 index 186d685d12..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java deleted file mode 100644 index 1f85afa2cc..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java deleted file mode 100644 index c13dabb17e..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java deleted file mode 100644 index a952ebe34d..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java deleted file mode 100644 index 617206b6af..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java deleted file mode 100644 index fff32e3398..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java +++ /dev/null @@ -1,357 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java deleted file mode 100644 index f1007e8c07..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java deleted file mode 100644 index 4c64676451..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java deleted file mode 100644 index f21a5be52e..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java deleted file mode 100644 index 923af1882c..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java deleted file mode 100644 index a894a7c48f..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java deleted file mode 100644 index 6adf66dc9e..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java deleted file mode 100644 index 9110731c34..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java deleted file mode 100644 index a44d80cc66..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java deleted file mode 100644 index 56aedd18f5..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java deleted file mode 100644 index 60cb42a981..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java deleted file mode 100644 index 08536d23b8..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java deleted file mode 100644 index f64317ac86..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java deleted file mode 100644 index 3743c7505b..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java deleted file mode 100644 index c11cee590a..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java deleted file mode 100644 index e91245504b..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java deleted file mode 100644 index 1a064e5092..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java deleted file mode 100644 index f71702792b..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java deleted file mode 100644 index d1432d0149..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java deleted file mode 100644 index ef180814ff..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java +++ /dev/null @@ -1,210 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java deleted file mode 100644 index 334e34ba5b..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java deleted file mode 100644 index c7c4bda7a1..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java deleted file mode 100644 index 95793cc439..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java deleted file mode 100644 index 6c5e0ef75d..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java deleted file mode 100644 index 8413350e50..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java deleted file mode 100644 index 68f9dfa6f8..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java deleted file mode 100644 index d384bcd670..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java deleted file mode 100644 index 999242a4c2..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java deleted file mode 100644 index a596eb539f..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java deleted file mode 100644 index 1f064e0977..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * - * 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/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java b/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java deleted file mode 100644 index f493356594..0000000000 --- a/branches/java-post-M1/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java +++ /dev/null @@ -1,212 +0,0 @@ -/** - * - * 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); - } - } - -} |