diff options
Diffstat (limited to 'tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl')
28 files changed, 0 insertions, 3267 deletions
diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java deleted file mode 100644 index 234fff6600..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java +++ /dev/null @@ -1,305 +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.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Definition; -import javax.wsdl.Import; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.Aggregate; -import org.apache.tuscany.model.assembly.AggregatePart; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Component; -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.ServiceURI; -import org.apache.tuscany.model.assembly.Wire; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.XSDHelper; - -/** - * An implementation of Aggregate. - */ -public abstract class AggregateImpl extends ExtensibleImpl implements Aggregate { - - private String name; - private List<Component> components=new ArrayList<Component>(); - private Map<String, Component> componentsMap; - private List<EntryPoint> entryPoints=new ArrayList<EntryPoint>(); - private Map<String, EntryPoint> entryPointsMap; - private List<ExternalService> externalServices=new ArrayList<ExternalService>(); - private Map<String, ExternalService> externalServicesMap; - private List<AggregatePart> aggregateParts; - private List<Wire> wires=new ArrayList<Wire>(); - private List<Import> wsdlImports=new ArrayList<Import>(); - private Map<String, List<Import>> wsdlImportsMap; - private AssemblyModelContext modelContext; - - /** - * Constructor - */ - protected AggregateImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getName() - */ - public String getName() { - return name; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#setName(java.lang.String) - */ - public void setName(String newName) { - checkNotFrozen(); - name=newName; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getComponents() - */ - public List<Component> getComponents() { - return components; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getComponent(java.lang.String) - */ - public Component getComponent(String name) { - checkInitialized(); - return componentsMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getEntryPoints() - */ - public List<EntryPoint> getEntryPoints() { - return entryPoints; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getEntryPoint(java.lang.String) - */ - public EntryPoint getEntryPoint(String name) { - checkInitialized(); - return entryPointsMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getExternalServices() - */ - public List<ExternalService> getExternalServices() { - return externalServices; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getExternalService(java.lang.String) - */ - public ExternalService getExternalService(String name) { - checkInitialized(); - return externalServicesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getAggregateParts() - */ - public List<AggregatePart> getAggregateParts() { - checkInitialized(); - return aggregateParts; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getWires() - */ - public List<Wire> getWires() { - return wires; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getWSDLImports() - */ - public List<Import> getWSDLImports() { - return wsdlImports; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getWSDLImports(java.lang.String) - */ - public List<Import> getWSDLImports(String namespace) { - checkInitialized(); - return wsdlImportsMap.get(namespace); - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getAssemblyModelContext() - */ - public AssemblyModelContext getAssemblyModelContext() { - checkInitialized(); - return modelContext; - } - - /** - * @see org.apache.tuscany.model.assembly.Aggregate#getConfiguredService(org.apache.tuscany.model.assembly.ServiceURI) - */ - public ConfiguredService getConfiguredService(ServiceURI address) { - String partName = address.getPartName(); - String serviceName = address.getServiceName(); - Component component = getComponent(partName); - if (component != null) { - if (serviceName != null) { - return component.getConfiguredService(serviceName); - } else { - if (!component.getConfiguredServices().isEmpty()) { - return component.getConfiguredServices().get(0); - } else { - return null; - } - } - - } else { - ExternalService externalService = getExternalService(partName); - if (externalService != null) { - return externalService.getConfiguredService(); - } else { - return null; - } - } - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Save the model context - this.modelContext=modelContext; - - // Populate map of WSDL imports - ResourceLoader resourceLoader=modelContext.getApplicationResourceLoader(); - wsdlImportsMap = new HashMap<String, List<Import>>(); - for (Import wsdlImport : wsdlImports) { - String namespace=wsdlImport.getNamespaceURI(); - List<Import> list=wsdlImportsMap.get(namespace); - if (list==null) { - list=new ArrayList<Import>(); - wsdlImportsMap.put(namespace, list); - } - list.add(wsdlImport); - - // Load the WSDL definition if necessary - if (wsdlImport.getDefinition()==null) { - String location=wsdlImport.getLocationURI(); - Definition definition; - ClassLoader ccl=Thread.currentThread().getContextClassLoader(); - try { - URL url=resourceLoader.getResource(location); - if (url==null) - throw new IllegalArgumentException("Cannot find "+location); - definition = modelContext.getAssemblyLoader().loadDefinition(url.toString()); - Thread.currentThread().setContextClassLoader(modelContext.getApplicationResourceLoader().getClassLoader()); - XSDHelper xsdHelper=SDOUtil.createXSDHelper(modelContext.getTypeHelper()); - xsdHelper.define (url.openStream(), null); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } finally { - Thread.currentThread().setContextClassLoader(ccl); - } - wsdlImport.setDefinition(definition); - } - } - - // Populate maps of components, entry points and external services - aggregateParts = new ArrayList<AggregatePart>(); - componentsMap = new HashMap<String, Component>(); - for (Component component : components) { - componentsMap.put(component.getName(), component); - aggregateParts.add(component); - component.initialize(modelContext); - ((AggregatePartImpl)component).setAggregate(this); - } - entryPointsMap = new HashMap<String, EntryPoint>(); - for (EntryPoint entryPoint : entryPoints) { - entryPointsMap.put(entryPoint.getName(), entryPoint); - aggregateParts.add(entryPoint); - entryPoint.initialize(modelContext); - ((AggregatePartImpl)entryPoint).setAggregate(this); - } - externalServicesMap = new HashMap<String, ExternalService>(); - for (ExternalService externalService : externalServices) { - externalServicesMap.put(externalService.getName(), externalService); - aggregateParts.add(externalService); - externalService.initialize(modelContext); - ((AggregatePartImpl)externalService).setAggregate(this); - } - for (Wire wire : wires) { - wire.initialize(modelContext); - } - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze lists - wsdlImports=Collections.unmodifiableList(wsdlImports); - freeze(wsdlImports); - components=Collections.unmodifiableList(components); - freeze(components); - entryPoints=Collections.unmodifiableList(entryPoints); - freeze(entryPoints); - externalServices=Collections.unmodifiableList(externalServices); - freeze(externalServices); - wires=Collections.unmodifiableList(wires); - freeze(wires); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(aggregateParts, visitor)) - return false; - - if (!accept(wires, visitor)) - return false; - - return true; - } - -} //ModuleImpl diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java deleted file mode 100644 index b9a4434c58..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.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.impl; - -import org.apache.tuscany.model.assembly.Aggregate; -import org.apache.tuscany.model.assembly.AggregatePart; - -/** - * Implementation of AggregatePart. - */ -public abstract class AggregatePartImpl extends ExtensibleImpl implements AggregatePart { - private Aggregate aggregate; - private String name; - - /** - * Constructor - */ - protected AggregatePartImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.AggregatePart#getName() - */ - public String getName() { - return name; - } - - /** - * @see org.apache.tuscany.model.assembly.AggregatePart#setName(java.lang.String) - */ - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - /** - * @see org.apache.tuscany.model.assembly.AggregatePart#getAggregate() - */ - public Aggregate getAggregate() { - checkInitialized(); - return aggregate; - } - - /** - * Sets the aggregate containing this aggregate part. - * @param aggregate - */ - protected void setAggregate(Aggregate aggregate) { - checkNotFrozen(); - this.aggregate=aggregate; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java deleted file mode 100644 index 0c2550ab10..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java +++ /dev/null @@ -1,204 +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.AggregatePart; -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.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.SimpleComponent; -import org.apache.tuscany.model.assembly.Subsystem; -import org.apache.tuscany.model.assembly.Wire; -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(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createSimpleComponent() - */ - public SimpleComponent createSimpleComponent() { - return new SimpleComponentImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createComponentType() - */ - public ComponentType createComponentType() { - return new ComponentTypeImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createEntryPoint() - */ - public EntryPoint createEntryPoint() { - return new EntryPointImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createExternalService() - */ - public ExternalService createExternalService() { - return new ExternalServiceImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createJavaServiceContract() - */ - public JavaServiceContract createJavaServiceContract() { - return new JavaServiceContractImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createModule() - */ - public Module createModule() { - return new ModuleImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createModuleFragment() - */ - public ModuleFragment createModuleFragment() { - return new ModuleFragmentImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createModuleComponent() - */ - public ModuleComponent createModuleComponent() { - return new ModuleComponentImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createProperty() - */ - public Property createProperty() { - return new PropertyImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createConfiguredProperty() - */ - public ConfiguredProperty createConfiguredProperty() { - return new ConfiguredPropertyImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createReference() - */ - public Reference createReference() { - return new ReferenceImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createConfiguredReference() - */ - public ConfiguredReference createConfiguredReference() { - return new ConfiguredReferenceImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createService() - */ - public Service createService() { - return new ServiceImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createConfiguredService() - */ - public ConfiguredService createConfiguredService() { - return new ConfiguredServiceImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createSubsystem() - */ - public Subsystem createSubsystem() { - return new SubsystemImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createWSDLServiceContract() - */ - public WSDLServiceContract createWSDLServiceContract() { - return new WSDLServiceContractImpl(); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createServiceURI(java.lang.String) - */ - public ServiceURI createServiceURI(String uri) { - return new ServiceURIImpl(uri); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createServiceURI(org.apache.tuscany.model.assembly.ModuleComponent, java.lang.String) - */ - public ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName) { - return new ServiceURIImpl(moduleComponent, serviceName); - } - - /* - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createServiceURI(org.apache.tuscany.model.assembly.ModuleComponent, org.apache.tuscany.model.assembly.AggregatePart, org.apache.tuscany.model.assembly.ConfiguredPort) - */ - public ServiceURI createServiceURI(ModuleComponent moduleComponent, AggregatePart aggregatePart, ConfiguredPort configuredPort) { - return new ServiceURIImpl(moduleComponent, aggregatePart, configuredPort); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createQName(java.lang.String) - */ - public QName createQName(String uri) { - int h = uri.indexOf('#'); - return new QName(uri.substring(0, h), uri.substring(h + 1)); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyFactory#createWire() - */ - public Wire createWire() { - return new WireImpl(); - } -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java deleted file mode 100644 index 221b3e0af6..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java +++ /dev/null @@ -1,92 +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.AssemblyModelContext; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.TypeHelper; - -/** - */ -public class AssemblyModelContextImpl implements AssemblyModelContext { - - private final AssemblyFactory assemblyFactory; - private final AssemblyModelLoader assemblyLoader; - private final ResourceLoader systemResourceLoader; - private final ResourceLoader applicationResourceLoader; - private final TypeHelper typeHelper; - - public AssemblyModelContextImpl(AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader) { - this(new AssemblyFactoryImpl(), assemblyLoader, resourceLoader, resourceLoader); - } - - public AssemblyModelContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader) { - this(assemblyFactory, assemblyLoader, resourceLoader, resourceLoader); - } - - public AssemblyModelContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader, ResourceLoader artifactLoader) { - this(assemblyFactory, assemblyLoader, resourceLoader, artifactLoader, SDOUtil.createTypeHelper()); - } - - public AssemblyModelContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader, ResourceLoader artifactLoader, TypeHelper typeHelper) { - this.assemblyFactory = assemblyFactory; - this.assemblyLoader = assemblyLoader; - this.systemResourceLoader = resourceLoader; - this.applicationResourceLoader = artifactLoader; - this.typeHelper=typeHelper; - - //FIXME the caller should configure the assemblyLoader himself - if (assemblyLoader!=null) - assemblyLoader.setModelContext(this); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getAssemblyFactory() - */ - public AssemblyFactory getAssemblyFactory() { - return assemblyFactory; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getSystemResourceLoader() - */ - public ResourceLoader getSystemResourceLoader() { - return systemResourceLoader; - } - - public ResourceLoader getApplicationResourceLoader() { - return applicationResourceLoader; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getAssemblyLoader() - */ - public AssemblyModelLoader getAssemblyLoader() { - return assemblyLoader; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getTypeHelper() - */ - public TypeHelper getTypeHelper() { - return typeHelper; - } -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java deleted file mode 100644 index 356fc4f0a9..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java +++ /dev/null @@ -1,132 +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 org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelObject; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; - -/** - * A base class for assembly model objects. - */ -public abstract class AssemblyModelObjectImpl implements AssemblyModelObject { - - private boolean frozen; - private boolean initialized; - - /** - * Constructor - */ - protected AssemblyModelObjectImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - return visitor.visit(this); - } - - /** - * Walk a visitor through a collection of model objects. - * @param collection - * @param visitor - * @return - */ - protected boolean accept(Collection collection, AssemblyModelVisitor visitor) { - for (Object member : collection) { - if (member instanceof AssemblyModelObject) { - if (!((AssemblyModelObject)member).accept(visitor)) - return false; - } - } - return true; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (!frozen) - frozen=true; - } - - /** - * Returns true if the object is frozen - */ - protected boolean isFrozen() { - return frozen; - } - - /** - * Freeze members of a collection - */ - protected void freeze(Collection collection) { - for (Object member : collection) { - if (member instanceof AssemblyModelObject) { - ((AssemblyModelObject)member).freeze(); - } - } - } - - /** - * 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"); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext 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, AssemblyModelContext modelContext) { - for (Object member : collection) { - if (member instanceof AssemblyModelObject) { - ((AssemblyModelObject)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/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java deleted file mode 100644 index cd1f0e2cb4..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java +++ /dev/null @@ -1,96 +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.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Binding; - -/** - * An implementation of Binding. - */ -public class BindingImpl extends ExtensibleImpl implements Binding { - - private String uri; - private Object runtimeConfiguration; - - /** - * Constructor - */ - protected BindingImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Binding#getURI() - */ - public String getURI() { - return uri; - } - - /** - * @see org.apache.tuscany.model.assembly.Binding#setURI(java.lang.String) - */ - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration() - */ - public Object getRuntimeConfiguration() { - return runtimeConfiguration; - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object) - */ - public void setRuntimeConfiguration(Object configuration) { - checkNotFrozen(); - this.runtimeConfiguration = configuration; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AggregateImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - return true; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java deleted file mode 100644 index 2033ebe7f7..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java +++ /dev/null @@ -1,222 +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.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentImplementation; -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.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of Component. - */ -public abstract class ComponentImpl extends AggregatePartImpl implements Component { - - private List<ConfiguredReference> configuredReferences=new ArrayList<ConfiguredReference>(); - private Map<String, ConfiguredReference> configuredReferencesMap; - private List<ConfiguredService> configuredServices=new ArrayList<ConfiguredService>(); - private Map<String, ConfiguredService> configuredServicesMap; - private List<ConfiguredProperty> configuredProperties=new ArrayList<ConfiguredProperty>(); - private Map<String, ConfiguredProperty> configuredPropertiesMap; - private ComponentImplementation implementation; - - /** - * @see org.apache.tuscany.model.assembly.Component#getComponentImplementation() - */ - public ComponentImplementation getComponentImplementation() { - return implementation; - } - - /** - * @see org.apache.tuscany.model.assembly.Component#setComponentImplementation(org.apache.tuscany.model.assembly.ComponentImplementation) - */ - public void setComponentImplementation(ComponentImplementation value) { - checkNotFrozen(); - implementation=value; - } - - /** - * @see org.apache.tuscany.model.assembly.Component#getConfiguredServices() - */ - public List<ConfiguredService> getConfiguredServices() { - return configuredServices; - } - - public ConfiguredService getConfiguredService(String name) { - checkInitialized(); - return configuredServicesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.Component#getConfiguredReferences() - */ - public List<ConfiguredReference> getConfiguredReferences() { - return configuredReferences; - } - - /** - * @see org.apache.tuscany.model.assembly.Component#getConfiguredReference(java.lang.String) - */ - public ConfiguredReference getConfiguredReference(String name) { - checkInitialized(); - return configuredReferencesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.Component#getConfiguredProperties() - */ - public List<ConfiguredProperty> getConfiguredProperties() { - return configuredProperties; - } - - /** - * @see org.apache.tuscany.model.assembly.Component#getConfiguredProperty(java.lang.String) - */ - public ConfiguredProperty getConfiguredProperty(String name) { - checkInitialized(); - return configuredPropertiesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the implementation - ComponentImplementation implementation = getComponentImplementation(); - if (implementation != null) { - implementation.initialize(modelContext); - } - - // Derive the configured services, references and properties from the component implementation - //FIXME we have two options here: either just index the configured services, references and properties - // that we find in the corresponding lists, or derive them from the services, references and properties on - // the component type, for now just check if the lists are empty or not to determine which option to go with - configuredServicesMap = new HashMap<String, ConfiguredService>(); - configuredReferencesMap = new HashMap<String, ConfiguredReference>(); - configuredPropertiesMap = new HashMap<String, ConfiguredProperty>(); - if (configuredServices.isEmpty() && configuredReferences.isEmpty() && configuredProperties.isEmpty()) { - if (implementation != null) { - AssemblyFactory factory = modelContext.getAssemblyFactory(); - for (Service service : implementation.getComponentType().getServices()) { - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setPort(service); - configuredServices.add(configuredService); - configuredServicesMap.put(service.getName(), configuredService); - ((ConfiguredPortImpl)configuredService).setAggregatePart(this); - configuredService.initialize(modelContext); - } - - for (Reference reference : implementation.getComponentType().getReferences()) { - ConfiguredReference configuredReference = factory.createConfiguredReference(); - configuredReference.setPort(reference); - configuredReferences.add(configuredReference); - configuredReferencesMap.put(reference.getName(), configuredReference); - ((ConfiguredPortImpl)configuredReference).setAggregatePart(this); - configuredReference.initialize(modelContext); - } - - // Derive configured properties from the properties on the component type - for (Property property : implementation.getComponentType().getProperties()) { - ConfiguredProperty configuredProperty = factory.createConfiguredProperty(); - configuredProperty.setProperty(property); - configuredProperties.add(configuredProperty); - configuredPropertiesMap.put(property.getName(), configuredProperty); - configuredProperty.initialize(modelContext); - } - - } - } else { - - // Just populate the maps of services, references and properties from the contents of - // the corresponding lists - for (ConfiguredService configuredService : configuredServices) { - configuredServicesMap.put(configuredService.getService().getName(), configuredService); - ((ConfiguredPortImpl)configuredService).setAggregatePart(this); - configuredService.initialize(modelContext); - } - - for (ConfiguredReference configuredReference : configuredReferences) { - configuredReferencesMap.put(configuredReference.getReference().getName(), configuredReference); - ((ConfiguredPortImpl)configuredReference).setAggregatePart(this); - configuredReference.initialize(modelContext); - } - - for (ConfiguredProperty configuredProperty : configuredProperties) { - configuredPropertiesMap.put(configuredProperty.getProperty().getName(), configuredProperty); - configuredProperty.initialize(modelContext); - } - } - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze configured services, references and properties - configuredServices=Collections.unmodifiableList(configuredServices); - freeze(configuredServices); - configuredReferences=Collections.unmodifiableList(configuredReferences); - freeze(configuredReferences); - configuredProperties=Collections.unmodifiableList(configuredProperties); - freeze(configuredProperties); - if (implementation!=null) - implementation.freeze(); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor 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/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java deleted file mode 100644 index f14a86c713..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.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.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.ComponentImplementation; -import org.apache.tuscany.model.assembly.ComponentType; - -/** - * An implementation of ComponentImplementation. - */ -public class ComponentImplementationImpl extends ExtensibleImpl implements ComponentImplementation { - - private ComponentType componentType; - private Object runtimeConfiguration; - - /** - * Constructor - */ - protected ComponentImplementationImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentImplementation#getComponentType() - */ - public ComponentType getComponentType() { - return componentType; - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentImplementation#setComponentType(org.apache.tuscany.model.assembly.ComponentType) - */ - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType=componentType; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (componentType!=null) - componentType.initialize(modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze component type - if (componentType!=null) - componentType.freeze(); - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration() - */ - public Object getRuntimeConfiguration() { - return runtimeConfiguration; - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object) - */ - public void setRuntimeConfiguration(Object configuration) { - checkNotFrozen(); - this.runtimeConfiguration = configuration; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AggregateImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (componentType!=null) { - if (!componentType.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java deleted file mode 100644 index baef2e9b2a..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java +++ /dev/null @@ -1,152 +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.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of ComponentType. - */ -public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType { - - private List<Reference> references=new ArrayList<Reference>(); - private Map<String, Reference> referencesMap; - private List<Service> services=new ArrayList<Service>(); - private Map<String, Service> servicesMap; - private List<Property> properties=new ArrayList<Property>(); - private Map<String, Property> propertiesMap; - - /** - * Constructor - */ - protected ComponentTypeImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentType#getReferences() - */ - public List<Reference> getReferences() { - return references; - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentType#getReference(java.lang.String) - */ - public Reference getReference(String name) { - checkInitialized(); - return referencesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentType#getServices() - */ - public List<Service> getServices() { - return services; - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentType#getService(java.lang.String) - */ - public Service getService(String name) { - checkInitialized(); - return servicesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentType#getProperties() - */ - public List<Property> getProperties() { - return properties; - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentType#getProperty(java.lang.String) - */ - public Property getProperty(String name) { - checkInitialized(); - return propertiesMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Populate maps of references, properties and services - referencesMap = new HashMap<String, Reference>(); - for (Reference reference : references) { - referencesMap.put(reference.getName(), reference); - reference.initialize(modelContext); - } - propertiesMap = new HashMap<String, Property>(); - for (Property property : properties) { - propertiesMap.put(property.getName(), property); - property.initialize(modelContext); - } - servicesMap = new HashMap<String, Service>(); - for (Service service : services) { - servicesMap.put(service.getName(), service); - service.initialize(modelContext); - } - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze lists of services, references and properties - services=Collections.unmodifiableList(services); - freeze(services); - references=Collections.unmodifiableList(references); - freeze(references); - properties=Collections.unmodifiableList(properties); - freeze(properties); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor 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/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java deleted file mode 100644 index 9662d13dc7..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java +++ /dev/null @@ -1,142 +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.AggregatePart; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.Port; - -/** - * Implementation of ConfiguredPort. - */ -public abstract class ConfiguredPortImpl extends AssemblyModelObjectImpl implements ConfiguredPort { - private AggregatePart aggregatePart; - private Port port; - - private Object runtimeConfiguration; - private Object proxyFactory; - - /** - * Constructor - */ - protected ConfiguredPortImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredPort#getPort() - */ - public Port getPort() { - return port; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredPort#setPort(org.apache.tuscany.model.assembly.Port) - */ - public void setPort(Port port) { - checkNotFrozen(); - this.port = port; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredPort#getAggregatePart() - */ - public AggregatePart getAggregatePart() { - checkInitialized(); - return aggregatePart; - } - - /** - * Sets the aggregate part containing this configured port. - * @param aggregatePart - */ - protected void setAggregatePart(AggregatePart aggregatePart) { - checkNotFrozen(); - this.aggregatePart=aggregatePart; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredPort#getProxyFactory() - */ - public Object getProxyFactory() { - return proxyFactory; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredPort#setProxyFactory(java.lang.Object) - */ - public void setProxyFactory(Object proxyFactory) { - checkNotFrozen(); - this.proxyFactory = proxyFactory; - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration() - */ - public Object getRuntimeConfiguration() { - return runtimeConfiguration; - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object) - */ - public void setRuntimeConfiguration(Object configuration) { - checkNotFrozen(); - runtimeConfiguration = configuration; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (port!=null) - port.initialize(modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (port!=null) - port.freeze(); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (port!=null) { - if (!port.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java deleted file mode 100644 index 477c62ad44..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.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 org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -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 AssemblyModelObjectImpl implements ConfiguredProperty { - private Property property; - private OverrideOption overrideOption; - private Object value; - - /** - * Constructor - */ - protected ConfiguredPropertyImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredProperty#getProperty() - */ - public Property getProperty() { - return property; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredProperty#setProperty(org.apache.tuscany.model.assembly.Property) - */ - public void setProperty(Property property) { - checkNotFrozen(); - this.property = property; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredProperty#getValue() - */ - public Object getValue() { - return value; - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredProperty#setValue(java.lang.Object) - */ - public void setValue(Object value) { - checkNotFrozen(); - this.value = value; - } - - /* - * @see org.apache.tuscany.model.assembly.ConfiguredProperty#getOverrideOption() - */ - public OverrideOption getOverrideOption() { - return overrideOption; - } - - /* - * @see org.apache.tuscany.model.assembly.ConfiguredProperty#setOverrideOption(org.apache.tuscany.model.assembly.OverrideOption) - */ - public void setOverrideOption(OverrideOption value) { - checkNotFrozen(); - this.overrideOption=value; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (property!=null) - property.initialize(modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (property!=null) - property.freeze(); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (property!=null) { - if (!property.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java deleted file mode 100644 index c9bc9b332f..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.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 java.util.ArrayList; -import java.util.Collections; -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 implements ConfiguredReference { - - private List<ConfiguredService> targetConfiguredServices = new ArrayList<ConfiguredService>(); - - /** - * Constructor - */ - protected ConfiguredReferenceImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredReference#getReference() - */ - public Reference getReference() { - return (Reference) super.getPort(); - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredReference#setReference(org.apache.tuscany.model.assembly.Reference) - */ - public void setReference(Reference reference) { - checkNotFrozen(); - super.setPort(reference); - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredReference#getTargetConfiguredServices() - */ - public List<ConfiguredService> getTargetConfiguredServices() { - return targetConfiguredServices; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.ConfiguredPortImpl#freeze() - */ - public void freeze() { - super.freeze(); - - // Freeze list of configured services - targetConfiguredServices=Collections.unmodifiableList(targetConfiguredServices); - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java deleted file mode 100644 index 3e5d1a9cf5..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.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.impl; - -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of ConfiguredService. - */ -public class ConfiguredServiceImpl extends ConfiguredPortImpl implements ConfiguredService { - - /** - * Constructor - */ - protected ConfiguredServiceImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredService#getService() - */ - public Service getService() { - return (Service) super.getPort(); - } - - /** - * @see org.apache.tuscany.model.assembly.ConfiguredService#setService(org.apache.tuscany.model.assembly.Service) - */ - public void setService(Service service) { - checkNotFrozen(); - super.setPort(service); - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java deleted file mode 100644 index 0d39089be9..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java +++ /dev/null @@ -1,145 +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.Collections; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -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 AggregatePartImpl implements EntryPoint { - - private ConfiguredService configuredService; - private ConfiguredReference configuredReference; - private List<Binding> bindings=new ArrayList<Binding>(); - - /** - * Constructor - */ - protected EntryPointImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.EntryPoint#getConfiguredReference() - */ - public ConfiguredReference getConfiguredReference() { - return configuredReference; - } - - /** - * @see org.apache.tuscany.model.assembly.EntryPoint#setConfiguredReference(org.apache.tuscany.model.assembly.ConfiguredReference) - */ - public void setConfiguredReference(ConfiguredReference configuredReference) { - checkNotFrozen(); - this.configuredReference=configuredReference; - } - - /** - * @see org.apache.tuscany.model.assembly.EntryPoint#getConfiguredService() - */ - public ConfiguredService getConfiguredService() { - return configuredService; - } - - /** - * @see org.apache.tuscany.model.assembly.EntryPoint#setConfiguredService(org.apache.tuscany.model.assembly.ConfiguredService) - */ - public void setConfiguredService(ConfiguredService configuredService) { - checkNotFrozen(); - this.configuredService=configuredService; - } - - /** - * @see org.apache.tuscany.model.assembly.EntryPoint#getBindings() - */ - public List<Binding> getBindings() { - return bindings; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the service contract and reference to the published service - if (configuredReference != null) { - ((ConfiguredPortImpl)configuredReference).setAggregatePart(this); - configuredReference.initialize(modelContext); - } - if (configuredService != null) { - ((ConfiguredPortImpl)configuredService).setAggregatePart(this); - configuredService.initialize(modelContext); - } - - // Initialize the bindings - initialize(bindings, modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - 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=Collections.unmodifiableList(bindings); - freeze(bindings); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor 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/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java deleted file mode 100644 index 05f2082ced..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java +++ /dev/null @@ -1,92 +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.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Extensible; - -/** - * An implementation of Extensible. - */ -public abstract class ExtensibleImpl extends AssemblyModelObjectImpl implements Extensible { - - private List<Object> extensibilityElements=new ArrayList<Object>(); - private List<Object> extensibilityAttributes=new ArrayList<Object>(); - - /** - * Constructor - */ - protected ExtensibleImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Extensible#getExtensibilityElements() - */ - public List getExtensibilityElements() { - return extensibilityElements; - } - - /** - * @see org.apache.tuscany.model.assembly.Extensible#getExtensibilityAttributes() - */ - public List getExtensibilityAttributes() { - return extensibilityAttributes; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext 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); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(extensibilityElements, visitor)) - return false; - if (!accept(extensibilityAttributes, visitor)) - return false; - - return true; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java deleted file mode 100644 index 33eced7e1f..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java +++ /dev/null @@ -1,135 +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.Collections; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -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 AggregatePartImpl implements ExternalService { - - private ConfiguredService configuredService; - private OverrideOption overrideOption; - private List<Binding> bindings=new ArrayList<Binding>(); - - /** - * Constructor - */ - protected ExternalServiceImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.sdo.impl.ExternalServiceImpl#getOverrideOption() - */ - public OverrideOption getOverrideOption() { - return overrideOption; - } - - /** - * @see org.apache.tuscany.model.assembly.ExternalService#setOverrideOption(org.apache.tuscany.model.assembly.OverrideOption) - */ - public void setOverrideOption(OverrideOption newOverridable) { - checkNotFrozen(); - overrideOption=newOverridable; - } - - /** - * @see org.apache.tuscany.model.assembly.ExternalService#getBindings() - */ - public List<Binding> getBindings() { - return bindings; - } - - /** - * @see org.apache.tuscany.model.assembly.ExternalService#getConfiguredService() - */ - public ConfiguredService getConfiguredService() { - return configuredService; - } - - /** - * @see org.apache.tuscany.model.assembly.ExternalService#setConfiguredService(org.apache.tuscany.model.assembly.ConfiguredService) - */ - public void setConfiguredService(ConfiguredService configuredService) { - checkNotFrozen(); - this.configuredService=configuredService; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the configured service - if (configuredService != null) { - ((ConfiguredPortImpl)configuredService).setAggregatePart(this); - configuredService.initialize(modelContext); - } - - // Initialize the bindings - initialize(bindings, modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze the configured service - if (configuredService!= null) - configuredService.freeze(); - - // Freeze the bindings - bindings=Collections.unmodifiableList(bindings); - freeze(bindings); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor 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/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java deleted file mode 100644 index d830c5c8d8..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java +++ /dev/null @@ -1,65 +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 implements ModuleComponent { - - private String uri; - - /** - * Constructor - */ - protected ModuleComponentImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ModuleComponent#setModuleImplementation(org.apache.tuscany.model.assembly.Module) - */ - public void setModuleImplementation(Module module) { - checkNotFrozen(); - super.setComponentImplementation(module); - } - - /** - * @see org.apache.tuscany.model.assembly.ModuleComponent#getModuleImplementation() - */ - public Module getModuleImplementation() { - return (Module)super.getComponentImplementation(); - } - - /** - * @see org.apache.tuscany.model.assembly.ModuleComponent#getURI() - */ - public String getURI() { - return uri; - } - - /** - * @see org.apache.tuscany.model.assembly.ModuleComponent#setURI(java.lang.String) - */ - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java deleted file mode 100644 index a36935dbfb..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.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.impl; - -import org.apache.tuscany.model.assembly.ModuleFragment; - -/** - * An implementation of ModuleFragment. - */ -public class ModuleFragmentImpl extends AggregateImpl implements ModuleFragment { - - /** - * Constructor - */ - protected ModuleFragmentImpl() { - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java deleted file mode 100644 index 8d89590225..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java +++ /dev/null @@ -1,243 +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.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -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.ModuleFragment; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.OverrideOption; -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; - -/** - * An implementation of Module. - */ -public class ModuleImpl extends AggregateImpl implements Module { - - private List<ModuleFragment> moduleFragments = new ArrayList<ModuleFragment>(); - private Map<String, ModuleFragment> moduleFragmentsMap; - private ComponentType componentType; - private Object runtimeConfiguration; - - /** - * Constructor - */ - protected ModuleImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentImplementation#getComponentType() - */ - public ComponentType getComponentType() { - return componentType; - } - - /** - * @see org.apache.tuscany.model.assembly.ComponentImplementation#setComponentType(org.apache.tuscany.model.assembly.ComponentType) - */ - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType=componentType; - } - - /** - * @see org.apache.tuscany.model.assembly.Module#getModuleFragments() - */ - public List<ModuleFragment> getModuleFragments() { - return moduleFragments; - } - - /** - * @see org.apache.tuscany.model.assembly.Module#getModuleFragment(java.lang.String) - */ - public ModuleFragment getModuleFragment(String name) { - checkInitialized(); - return moduleFragmentsMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - - // Populate map of module fragments - moduleFragmentsMap = new HashMap<String, ModuleFragment>(); - for (ModuleFragment moduleFragment : moduleFragments) { - moduleFragmentsMap.put(moduleFragment.getName(), moduleFragment); - - // 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 aggregate - super.initialize(modelContext); - - // Derive the component type from the entry points and external services in the module - // Also derive properties from the overridable properties of the components in the module - 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().getService().getServiceContract(); - if (serviceContract != null) - service.setServiceContract(serviceContract); - componentType.getServices().add(service); - } - 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().getService().getServiceContract(); - if (serviceContract != null) - reference.setServiceContract(serviceContract); - componentType.getReferences().add(reference); - } - for (Component component : getComponents()) { - for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) { - if (configuredProperty.getOverrideOption()==null || configuredProperty.getOverrideOption()==OverrideOption.NO) - continue; - componentType.getProperties().add(configuredProperty.getProperty()); - } - } - } - componentType.initialize(modelContext); - - - // Wire the module parts - 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 = getComponent(partName); - if (component != null) { - configuredReference = component.getConfiguredReference(referenceName); - } - } else { - EntryPoint entryPoint = getEntryPoint(partName); - if (entryPoint != null) { - configuredReference = entryPoint.getConfiguredReference(); - } - } - if (configuredReference == null) { - throw new IllegalArgumentException("Cannot find wire source " + sourceURI.getAddress()); - } 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.getReference().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 for " + targetURI.getAddress()); - } - } - } - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze component type and module fragments - if (componentType!=null) - componentType.freeze(); - moduleFragments=Collections.unmodifiableList(moduleFragments); - freeze(moduleFragments); - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration() - */ - public Object getRuntimeConfiguration() { - return runtimeConfiguration; - } - - /** - * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object) - */ - public void setRuntimeConfiguration(Object configuration) { - checkNotFrozen(); - this.runtimeConfiguration = configuration; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AggregateImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (componentType!=null) { - if (!componentType.accept(visitor)) - return false; - } - - if (!accept(moduleFragments, visitor)) - return false; - - return true; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java deleted file mode 100644 index ae92300d4e..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.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.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Port; -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * An implementation of Port. - */ -public abstract class PortImpl extends AssemblyModelObjectImpl implements Port { - - private ServiceContract serviceContract; - private String name; - - /** - * Constructor - */ - protected PortImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Port#getName() - */ - public String getName() { - return name; - } - - /** - * @see org.apache.tuscany.model.assembly.Port#setName(java.lang.String) - */ - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - /** - * @see org.apache.tuscany.model.assembly.Port#getServiceContract() - */ - public ServiceContract getServiceContract() { - return serviceContract; - } - - /** - * @see org.apache.tuscany.model.assembly.Port#setServiceContract(org.apache.tuscany.model.assembly.ServiceContract) - */ - public void setServiceContract(ServiceContract value) { - checkNotFrozen(); - serviceContract=value; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (serviceContract!=null) - serviceContract.initialize(modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (serviceContract!=null) - serviceContract.freeze(); - } - - /** - * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor) - */ - public boolean accept(AssemblyModelVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (serviceContract!=null) { - if (!serviceContract.accept(visitor)) - return false; - } - - return true; - } -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java deleted file mode 100644 index f79ad2df3b..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java +++ /dev/null @@ -1,178 +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.math.BigDecimal; -import java.math.BigInteger; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.Type; - -/** - * 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; - - private Type sdoType; - - /** - * Constructor - */ - protected PropertyImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Property#getDefaultValue() - */ - public Object getDefaultValue() { - return defaultValue; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#getName() - */ - public String getName() { - return name; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#getType() - */ - public Class getType() { - return type; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#isMany() - */ - public boolean isMany() { - return many; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#isRequired() - */ - public boolean isRequired() { - return required; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#setDefaultValue(java.lang.Object) - */ - public void setDefaultValue(Object value) { - defaultValue=value; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#setMany(boolean) - */ - public void setMany(boolean value) { - checkNotFrozen(); - many=value; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#setName(java.lang.String) - */ - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#setRequired(boolean) - */ - public void setRequired(boolean value) { - checkNotFrozen(); - required=value; - } - - /** - * @see org.apache.tuscany.model.assembly.Property#setType(java.lang.Class) - */ - public void setType(Class value) { - checkNotFrozen(); - type=value; - } - - /** - * @param sdoType The sdoType to set. - */ - public void setSDOType(Type sdoType) { - checkNotFrozen(); - this.sdoType = sdoType; - } - - /** - * @return Returns the sdoType. - */ - public Type getSDOType() { - return sdoType; - } - - private final static Map<Class, Type> typeMapping=new HashMap<Class, Type>(); - - static { - typeMapping.put(BigDecimal.class, SDOUtil.getXSDSDOType("decimal")); - typeMapping.put(BigInteger.class, SDOUtil.getXSDSDOType("integer")); - typeMapping.put(boolean.class, SDOUtil.getXSDSDOType("boolean")); - typeMapping.put(Boolean.class, SDOUtil.getXSDSDOType("boolean")); - typeMapping.put(byte.class, SDOUtil.getXSDSDOType("byte")); - typeMapping.put(Byte.class, SDOUtil.getXSDSDOType("Byte")); - typeMapping.put(byte[].class, SDOUtil.getXSDSDOType("hexBinary")); - typeMapping.put(char.class, SDOUtil.getXSDSDOType("string")); - typeMapping.put(Character.class, SDOUtil.getXSDSDOType("string")); - typeMapping.put(Date.class, SDOUtil.getXSDSDOType("dateTime")); - typeMapping.put(double.class, SDOUtil.getXSDSDOType("double")); - typeMapping.put(Double.class, SDOUtil.getXSDSDOType("double")); - typeMapping.put(float.class, SDOUtil.getXSDSDOType("float")); - typeMapping.put(Float.class, SDOUtil.getXSDSDOType("float")); - typeMapping.put(int.class, SDOUtil.getXSDSDOType("int")); - typeMapping.put(Integer.class, SDOUtil.getXSDSDOType("int")); - typeMapping.put(long.class, SDOUtil.getXSDSDOType("long")); - typeMapping.put(Long.class, SDOUtil.getXSDSDOType("long")); - typeMapping.put(short.class, SDOUtil.getXSDSDOType("short")); - typeMapping.put(Short.class, SDOUtil.getXSDSDOType("short")); - typeMapping.put(String.class, SDOUtil.getXSDSDOType("string")); - } - - /* - * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext) - */ - public void initialize(AssemblyModelContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Get the SDO type corresponding to the property's Java type - if (sdoType==null) { - sdoType=typeMapping.get(type); - } - } -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java deleted file mode 100644 index 8a2d348edc..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java +++ /dev/null @@ -1,50 +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; - - /** - * Constructor - */ - protected ReferenceImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Reference#getMultiplicity() - */ - public Multiplicity getMultiplicity() { - return multiplicity; - } - - /** - * @see org.apache.tuscany.model.assembly.Reference#setMultiplicity(org.apache.tuscany.model.assembly.Multiplicity) - */ - public void setMultiplicity(Multiplicity multiplicity) { - checkNotFrozen(); - this.multiplicity=multiplicity; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java deleted file mode 100644 index c9fe9b269d..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.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.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; - - /** - * Constructor - */ - protected ServiceContractImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.ServiceContract#getCallbackInterface() - */ - public Class getCallbackInterface() { - return callbackInterface; - } - - /** - * @see org.apache.tuscany.model.assembly.ServiceContract#getInterface() - */ - public Class getInterface() { - return interface_; - } - - /** - * @see org.apache.tuscany.model.assembly.ServiceContract#getScope() - */ - public Scope getScope() { - return scope; - } - - /** - * @see org.apache.tuscany.model.assembly.ServiceContract#setCallbackInterface(java.lang.Class) - */ - public void setCallbackInterface(Class value) { - checkNotFrozen(); - callbackInterface=value; - } - - /** - * @see org.apache.tuscany.model.assembly.ServiceContract#setInterface(java.lang.Class) - */ - public void setInterface(Class value) { - checkNotFrozen(); - interface_=value; - } - - /** - * @see org.apache.tuscany.model.assembly.ServiceContract#setScope(org.apache.tuscany.model.assembly.Scope) - */ - public void setScope(Scope scope) { - checkNotFrozen(); - this.scope=scope; - } -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java deleted file mode 100644 index 230d89e373..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.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.impl; - -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of Service. - */ -public class ServiceImpl extends PortImpl implements Service { - - /** - * Constructor - */ - protected ServiceImpl() { - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java deleted file mode 100644 index 6d2972fb7d..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java +++ /dev/null @@ -1,198 +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.eclipse.emf.common.util.URI; - -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.AggregatePart; -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; - - /** - * Constructor - */ - protected ServiceURIImpl(String address) { - this.address = address; - } - - /** - * Constructor - * - * @param moduleComponent - * @param configuredPort - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, AggregatePart aggregatePart, ConfiguredPort configuredPort) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - if (configuredPort instanceof ConfiguredService) { - partName = aggregatePart.getName(); - ConfiguredService configuredService = (ConfiguredService) configuredPort; - Service service = configuredService.getService(); - if (service != null) { - serviceName = configuredService.getService().getName(); - address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; - } else { - address = "sca:///" + moduleComponentName + '/' + partName; - } - - } else if (configuredPort instanceof ConfiguredReference) { - ConfiguredReference configuredReference = (ConfiguredReference) configuredPort; - partName = aggregatePart.getName(); - serviceName = configuredReference.getReference().getName(); - if (serviceName!=null) - address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; - else - address = "sca:///" + moduleComponentName + '/' + partName; - } - - isSCAScheme = Boolean.TRUE; - isParsed = true; - } - - /** - * Constructor - * - * @param moduleComponent - * @param service - */ - 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; - } - - /** - * Returns true if the address scheme is sca: - * - * @return - */ - public boolean isSCAScheme() { - if (isSCAScheme == null) { - if (address.startsWith("sca://")) { - isSCAScheme = Boolean.TRUE; - } else { - isSCAScheme = Boolean.FALSE; - } - } - return isSCAScheme.booleanValue(); - } - - /** - * Returns a URI for this address - * - * @return - */ - public URI getURI() { - return URI.createURI(address); - } - - /** - * @return Returns the address. - */ - public String getAddress() { - return address; - } - - /** - * 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 - * - * @return - */ - public String getModuleComponentName() { - if (!isParsed) - parse(); - return moduleComponentName; - } - - /** - * Returns the part name - * - * @return - */ - public String getPartName() { - if (!isParsed) - parse(); - return partName; - } - - /** - * Returns the service name - * @return - */ - public String getServiceName() { - if (!isParsed) - parse(); - return serviceName; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SimpleComponentImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SimpleComponentImpl.java deleted file mode 100644 index 6de56e0806..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SimpleComponentImpl.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.impl; - -import org.apache.tuscany.model.assembly.SimpleComponent; - -/** - * An implementation of SimpleComponent. - */ -public class SimpleComponentImpl extends ComponentImpl implements SimpleComponent { - - /** - * Constructor - */ - protected SimpleComponentImpl() { - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java deleted file mode 100644 index 7dc78ee1e6..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.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.impl; - -import org.apache.tuscany.model.assembly.Subsystem; - -/** - * An implementation of Subsystem. - */ -public class SubsystemImpl extends AggregateImpl implements Subsystem { - - private String uri; - - /** - * Constructor - */ - protected SubsystemImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Subsystem#getURI() - */ - public String getURI() { - return uri; - } - - /** - * @see org.apache.tuscany.model.assembly.Subsystem#setURI(java.lang.String) - */ - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - -} diff --git a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java b/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java deleted file mode 100644 index 6cbf34334f..0000000000 --- a/tags/java-stable-20060304/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.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.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; - - /** - * Constructor - */ - protected WireImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Wire#getSource() - */ - public ServiceURI getSource() { - return source; - } - - /** - * @see org.apache.tuscany.model.assembly.Wire#setSource(org.apache.tuscany.model.assembly.ServiceURI) - */ - public void setSource(ServiceURI uri) { - checkNotFrozen(); - source=uri; - } - - /** - * @see org.apache.tuscany.model.assembly.Wire#getTarget() - */ - public ServiceURI getTarget() { - return target; - } - - /** - * @see org.apache.tuscany.model.assembly.Wire#setTarget(org.apache.tuscany.model.assembly.ServiceURI) - */ - public void setTarget(ServiceURI uri) { - checkNotFrozen(); - target=uri; - } - -} |