diff options
Diffstat (limited to 'tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl')
30 files changed, 0 insertions, 2863 deletions
diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java deleted file mode 100644 index a7f9012db7..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.TypeHelper; - -/** - */ -public class AssemblyContextImpl implements AssemblyContext { - - private final AssemblyFactory assemblyFactory; - private final AssemblyModelLoader assemblyLoader; - private final ResourceLoader applicationResourceLoader; - private final TypeHelper typeHelper; - private String webAppName; - - public AssemblyContextImpl(AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader) { - this(new AssemblyFactoryImpl(), assemblyLoader, resourceLoader); - } - - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader) { - this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper()); - } - - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, String webAppName) { - this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), webAppName); - } - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper) { - this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), null); - } - - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper, String webAppName) { - this.assemblyFactory = assemblyFactory; - this.assemblyLoader = assemblyLoader; - this.applicationResourceLoader = artifactLoader; - this.typeHelper=typeHelper; - this.webAppName=webAppName; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyFactory() - */ - public AssemblyFactory getAssemblyFactory() { - return assemblyFactory; - } - - public ResourceLoader getApplicationResourceLoader() { - return applicationResourceLoader; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyLoader() - */ - public AssemblyModelLoader getAssemblyLoader() { - return assemblyLoader; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyContext#getTypeHelper() - */ - public TypeHelper getTypeHelper() { - return typeHelper; - } - - public String getWebAppName() { - return webAppName; - } -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java deleted file mode 100644 index c88ea4448f..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java +++ /dev/null @@ -1,217 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.Subsystem; -import org.apache.tuscany.model.assembly.Wire; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.apache.tuscany.model.assembly.ImportWSDL; -import org.apache.tuscany.model.types.java.JavaServiceContract; -import org.apache.tuscany.model.types.java.impl.JavaServiceContractImpl; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; -import org.apache.tuscany.model.types.wsdl.impl.WSDLServiceContractImpl; - -/** - * Default implementation of AssemblyFactory - */ -public class AssemblyFactoryImpl implements AssemblyFactory { - - /** - * Constructor - */ - public AssemblyFactoryImpl() { - super(); - } - - public AtomicComponent createSimpleComponent() { - return new AtomicComponentImpl(); - } - - public ComponentType createComponentType() { - return new ComponentTypeImpl(); - } - - public EntryPoint createEntryPoint() { - return new EntryPointImpl(); - } - - public ExternalService createExternalService() { - return new ExternalServiceImpl(); - } - - public JavaServiceContract createJavaServiceContract() { - return new JavaServiceContractImpl(); - } - - public Module createModule() { - return new ModuleImpl(); - } - - public ModuleFragment createModuleFragment() { - return new ModuleFragmentImpl(); - } - - public ModuleComponent createModuleComponent() { - return new ModuleComponentImpl(); - } - - public Property createProperty() { - return new PropertyImpl(); - } - - public ConfiguredProperty createConfiguredProperty() { - return new ConfiguredPropertyImpl(); - } - - public Reference createReference() { - return new ReferenceImpl(); - } - - public ConfiguredReference createConfiguredReference() { - return new ConfiguredReferenceImpl(); - } - - public Service createService() { - return new ServiceImpl(); - } - - public ConfiguredService createConfiguredService() { - return new ConfiguredServiceImpl(); - } - - public Subsystem createSubsystem() { - return new SubsystemImpl(); - } - - public WSDLServiceContract createWSDLServiceContract() { - return new WSDLServiceContractImpl(); - } - - public ServiceURI createServiceURI(String uri) { - return new ServiceURIImpl(uri); - } - - public ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName) { - return new ServiceURIImpl(moduleComponent, serviceName); - } - - public ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) { - return new ServiceURIImpl(moduleComponent, part, configuredPort); - } - - public ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName) { - return new ServiceURIImpl(moduleComponent,partName,serviceName); - } - - public QName createQName(String uri) { - int h = uri.indexOf('#'); - return new QName(uri.substring(0, h), uri.substring(h + 1)); - } - - public Wire createWire() { - return new WireImpl(); - } - - public Reference createReference(String name, Class<?> service) { - return createReference(name,service,Multiplicity.ZERO_ONE); - } - - public Reference createReference(String name, Class<?> service, Multiplicity multiplicity){ - JavaServiceContract refContract = createJavaServiceContract(); - refContract.setInterface(service); - Reference reference = createReference(); - reference.setName(name); - reference.setServiceContract(refContract); - reference.setMultiplicity(multiplicity); - return reference; - } - - public ConfiguredReference createConfiguredReference(String name, String... targets) { - ConfiguredReference ref = createConfiguredReference(); - ref.setName(name); - for (String target : targets) { - ref.getTargets().add(target); - } - return ref; - } - - public EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName) { - // create and configure the exposed service - Service service = createService(); - service.setName(entryPointName); - service.setServiceContract(serviceContract); - ConfiguredService configuredService = createConfiguredService(); - configuredService.setPort(service); - - // create and configure a reference to target - Reference reference = createReference(); - reference.setMultiplicity(Multiplicity.ONE_ONE); - reference.setServiceContract(serviceContract); - ConfiguredReference configuredReference = createConfiguredReference(null, targetName); - configuredReference.setPort(reference); - - return createEntryPoint(entryPointName, configuredService, binding, configuredReference); - } - - public EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference) { - EntryPoint entryPoint = createEntryPoint(); - entryPoint.setName(entryPointName); - entryPoint.setConfiguredService(configuredService); - entryPoint.setConfiguredReference(configuredReference); - entryPoint.getBindings().add((Binding)binding); - return entryPoint; - } - - public Property createProperty(String name, Class<?> type) { - Property property = createProperty(); - property.setName(name); - property.setType(type); - return property; - } - - public ImportWSDL createImportWSDL() { - return new ImportWSDLImpl(); - } - - public ImportWSDL createImportWSDL(String location, String namespace) { - ImportWSDL importWSDL = createImportWSDL(); - importWSDL.setLocation(location); - importWSDL.setNamespace(namespace); - return importWSDL; - } -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java deleted file mode 100644 index 38056e1e1c..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.AssemblyVisitor; - -/** - * A base class for assembly model objects. - */ -public abstract class AssemblyObjectImpl implements AssemblyObject { - - private boolean frozen; - private boolean initialized; - - protected AssemblyObjectImpl() { - } - - public boolean accept(AssemblyVisitor visitor) { - return visitor.visit(this); - } - - /** - * Walk a visitor through a collection of model objects. - * @param collection - * @param visitor - */ - protected boolean accept(Collection collection, AssemblyVisitor visitor) { - for (Object member : collection) { - if (member instanceof AssemblyObject) { - if (!((AssemblyObject)member).accept(visitor)) - return false; - } - } - return true; - } - - public void freeze() { - if (!frozen) - frozen=true; - } - - /** - * Returns true if the object is frozen - */ - protected boolean isFrozen() { - return frozen; - } - - /** - * Freeze a list and its members - */ - protected <T> List<T> freeze(List<T> list) { - list=Collections.unmodifiableList(list); - for (Object member : list) { - if (member instanceof AssemblyObject) { - ((AssemblyObject)member).freeze(); - } - } - return list; - } - - /** - * Check that the current model object can be modified. - * @throws IllegalStateException - */ - protected void checkNotFrozen() { - if (frozen) - throw new IllegalStateException("Attempt to modify a frozen assembly model"); - } - - public void initialize(AssemblyContext modelContext) { - if (!initialized) - initialized=true; - } - - /** - * Returns true if the object is initialized - */ - protected boolean isInitialized() { - return initialized; - } - - /** - * Initialize members of a collection - */ - protected void initialize(Collection collection, AssemblyContext modelContext) { - for (Object member : collection) { - if (member instanceof AssemblyObject) { - ((AssemblyObject)member).initialize(modelContext); - } - } - } - - /** - * Check that the current model object is initialized. - * @throws IllegalStateException - */ - protected void checkInitialized() { - if (!initialized) - throw new IllegalStateException("Attempt to use an uninitialized assembly model"); - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java deleted file mode 100644 index 186d685d12..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.AtomicImplementation; - -/** - * An implementation of AtomicComponent. - */ -public class AtomicComponentImpl extends ComponentImpl<AtomicImplementation> implements AtomicComponent { - - protected AtomicComponentImpl() { - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java deleted file mode 100644 index 1f85afa2cc..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AtomicImplementation; - -/** - * An implementation of AtomicImplementation. - */ -public abstract class AtomicImplementationImpl extends ImplementationImpl implements AtomicImplementation { - - protected AtomicImplementationImpl() { - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java deleted file mode 100644 index c13dabb17e..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; - -/** - * An implementation of Binding. - */ -public class BindingImpl extends ExtensibleImpl implements Binding { - - private String uri; - - protected BindingImpl() { - } - - public String getURI() { - return uri; - } - - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java deleted file mode 100644 index a952ebe34d..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyInitializationException; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of Component. - */ -public abstract class ComponentImpl<I extends Implementation> extends PartImpl implements Component<I> { - - /** - * A list of configured ports synchronized with a map - */ - private class ConfiguredPortList<E extends ConfiguredPort> extends NotifyingList<E>{ - - Map<String, E> map; - - private ConfiguredPortList(Map<String, E> map) { - this.map=map; - } - - protected void added(E element) { - String name=element.getPort()!=null? element.getPort().getName():element.getName(); - map.put(name, element); - element.setPart(ComponentImpl.this); - } - protected void removed(E element) { - String name=element.getPort()!=null? element.getPort().getName():element.getName(); - map.remove(name); - element.setPart(null); - } - } - - private Map<String, ConfiguredReference> configuredReferencesMap = new HashMap<String, ConfiguredReference>(); - private List<ConfiguredReference> configuredReferences = new ConfiguredPortList<ConfiguredReference>(configuredReferencesMap); - - private Map<String, ConfiguredService> configuredServicesMap = new HashMap<String, ConfiguredService>(); - private List<ConfiguredService> configuredServices = new ConfiguredPortList<ConfiguredService>(configuredServicesMap); - - /** - * A list of properties synchronized with a map - */ - private class ConfiguredPropertyList<E extends ConfiguredProperty> extends NotifyingList<E>{ - - protected void added(E element) { - String name=element.getProperty()!=null? element.getProperty().getName():element.getName(); - configuredPropertiesMap.put(name, element); - } - protected void removed(E element) { - String name=element.getProperty()!=null? element.getProperty().getName():element.getName(); - configuredPropertiesMap.remove(name); - } - } - - private List<ConfiguredProperty> configuredProperties = new ConfiguredPropertyList<ConfiguredProperty>(); - private Map<String, ConfiguredProperty> configuredPropertiesMap=new HashMap<String, ConfiguredProperty>(); - - private I implementation; - - public I getImplementation() { - return implementation; - } - - public void setImplementation(I value) { - checkNotFrozen(); - implementation = value; - } - - public List<ConfiguredService> getConfiguredServices() { - return configuredServices; - } - - public ConfiguredService getConfiguredService(String name) { - return configuredServicesMap.get(name); - } - - public List<ConfiguredReference> getConfiguredReferences() { - return configuredReferences; - } - - public ConfiguredReference getConfiguredReference(String name) { - return configuredReferencesMap.get(name); - } - - public List<ConfiguredProperty> getConfiguredProperties() { - return configuredProperties; - } - - public ConfiguredProperty getConfiguredProperty(String name) { - return configuredPropertiesMap.get(name); - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the implementation - if (implementation == null) { - throw new AssemblyInitializationException("No implementation for component [" + getName() + ']'); - } - implementation.initialize(modelContext); - - // Derive the configured services from the component implementation - ComponentType componentType=implementation.getComponentType(); - AssemblyFactory factory = modelContext.getAssemblyFactory(); - for (Service service : componentType.getServices()) { - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setPort(service); - configuredServices.add(configuredService); - configuredService.initialize(modelContext); - } - - // Derive the configured references from the references on the component info - for (Reference reference : componentType.getReferences()) { - ConfiguredReference configuredReference = configuredReferencesMap.get(reference.getName()); - if (configuredReference==null) { - configuredReference=factory.createConfiguredReference(); - configuredReference.setPort(reference); - configuredReferences.add(configuredReference); - configuredReference.initialize(modelContext); - } else { - configuredReference.setPort(reference); - configuredReference.initialize(modelContext); - } - } - for (ConfiguredReference configuredReference : configuredReferences) { - if (configuredReference.getPort()==null) { - throw new AssemblyInitializationException("Undefined reference ["+configuredReference.getName()+"]"); - } - } - - // Derive the configured properties from the properties on the component info - for (Property property : componentType.getProperties()) { - ConfiguredProperty configuredProperty = configuredPropertiesMap.get(property.getName()); - if (configuredProperty != null) { - configuredProperty.setProperty(property); - configuredProperty.initialize(modelContext); - } - } - for (ConfiguredProperty configuredProperty : configuredProperties) { - if (configuredProperty.getProperty()==null) { - throw new AssemblyInitializationException("Undefined property ["+configuredProperty.getName()+"]"); - } - } - - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze configured services, references and properties - configuredServices = freeze(configuredServices); - configuredReferences = freeze(configuredReferences); - configuredProperties = freeze(configuredProperties); - if (implementation != null) - implementation.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(configuredServices, visitor)) - return false; - if (!accept(configuredReferences, visitor)) - return false; - if (!accept(configuredProperties, visitor)) - return false; - if (implementation != null) { - if (!implementation.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java deleted file mode 100644 index 617206b6af..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Port; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of ComponentType. - */ -public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType { - - /** - * A list of ports synchronized with a map - */ - private class PortList<E extends Port> extends NotifyingList<E>{ - - Map<String, E> map; - - private PortList(Map<String, E> map) { - this.map=map; - } - - protected void added(E element) { - map.put(element.getName(), element); - } - protected void removed(E element) { - map.remove(element.getName()); - } - } - - private Map<String, Reference> referencesMap=new HashMap<String, Reference>(); - private List<Reference> references=new PortList<Reference>(referencesMap); - - private Map<String, Service> servicesMap=new HashMap<String, Service>(); - private List<Service> services=new PortList<Service>(servicesMap); - - /** - * A list of properties synchronized with a map - */ - private class PropertyList<E extends Property> extends NotifyingList<E>{ - - protected void added(E element) { - propertiesMap.put(element.getName(), element); - } - protected void removed(E element) { - propertiesMap.remove(element.getName()); - } - } - - private Map<String, Property> propertiesMap=new HashMap<String, Property>(); - private List<Property> properties=new PropertyList<Property>(); - - protected ComponentTypeImpl() { - } - - public List<Reference> getReferences() { - return references; - } - - public Reference getReference(String name) { - return referencesMap.get(name); - } - - public List<Service> getServices() { - return services; - } - - public Service getService(String name) { - return servicesMap.get(name); - } - - public List<Property> getProperties() { - return properties; - } - - public Property getProperty(String name) { - return propertiesMap.get(name); - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize references, properties and services - for (Reference reference : references) { - reference.initialize(modelContext); - } - for (Property property : properties) { - property.initialize(modelContext); - } - for (Service service : services) { - service.initialize(modelContext); - } - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze lists of services, references and properties - services=freeze(services); - references=freeze(references); - properties=freeze(properties); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(services, visitor)) - return false; - if (!accept(references, visitor)) - return false; - if (!accept(properties, visitor)) - return false; - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java deleted file mode 100644 index fff32e3398..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java +++ /dev/null @@ -1,357 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.ImportWSDL; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.Wire; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of Composite. - */ -public abstract class CompositeImpl extends ExtensibleImpl implements Composite { - - private String name; - private ComponentType componentType; - private Class<?> implementationClass; - - /** - * A list of parts synchronized with a map - */ - private class PartList<E extends Part> extends NotifyingList<E> { - protected void added(E element) { - partsMap.put(element.getName(), element); - element.setComposite(CompositeImpl.this); - } - - protected void removed(E element) { - partsMap.remove(element.getName()); - element.setComposite(null); - } - } - - private Map<String, Part> partsMap = new HashMap<String, Part>(); - - private List<Component> components = new PartList<Component>(); - private List<EntryPoint> entryPoints = new PartList<EntryPoint>(); - private List<ExternalService> externalServices = new PartList<ExternalService>(); - - private List<Wire> wires = new ArrayList<Wire>(); - - /** - * A list of WSDL imports synchronized with a map - */ - private class ImportWSDLList extends NotifyingList<ImportWSDL> { - protected void added(ImportWSDL element) { - List<ImportWSDL> importList = wsdlImportsMap.get(element.getNamespace()); - if (importList == null) { - importList = new ArrayList<ImportWSDL>(); - wsdlImportsMap.put(element.getNamespace(), importList); - } - importList.add(element); - } - - protected void removed(ImportWSDL element) { - List<ImportWSDL> importList = wsdlImportsMap.get(element.getNamespace()); - if (importList != null) { - importList.remove(element); - if (importList.isEmpty()) - wsdlImportsMap.remove(element.getNamespace()); - } - } - } - - private Map<String, List<ImportWSDL>> wsdlImportsMap = new HashMap<String, List<ImportWSDL>>(); - - private List<ImportWSDL> wsdlImports = new ImportWSDLList(); - - protected CompositeImpl() { - } - - public String getName() { - return name; - } - - public void setName(String newName) { - checkNotFrozen(); - name = newName; - } - - public List<Component> getComponents() { - return components; - } - - public List<EntryPoint> getEntryPoints() { - return entryPoints; - } - - public List<ExternalService> getExternalServices() { - return externalServices; - } - - public Part getPart(String name) { - return partsMap.get(name); - } - - public List<Wire> getWires() { - return wires; - } - - public List<ImportWSDL> getWSDLImports() { - return wsdlImports; - } - - public List<ImportWSDL> getWSDLImports(String namespace) { - return wsdlImportsMap.get(namespace); - } - - public ComponentType getComponentType() { - return componentType; - } - - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType = componentType; - } - - public ConfiguredService getConfiguredService(ServiceURI address) { - String partName = address.getPartName(); - String serviceName = address.getServiceName(); - Part part = getPart(partName); - if (part instanceof Component) { - Component<?> component = (Component<?>) part; - if (serviceName != null) { - return component.getConfiguredService(serviceName); - } else { - if (!component.getConfiguredServices().isEmpty()) { - return component.getConfiguredServices().get(0); - } else { - return null; - } - } - - } - if (part instanceof ExternalService) { - ExternalService externalService = (ExternalService) part; - return externalService.getConfiguredService(); - } else - return null; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize WSDL imports - for (ImportWSDL importWSDL : wsdlImports) { - importWSDL.initialize(modelContext); - } - - // Initialize parts - for (Part part : externalServices) { - part.initialize(modelContext); - } - for (Part part : components) { - part.initialize(modelContext); - } - for (Part part : entryPoints) { - part.initialize(modelContext); - } - - // Derive the component type from the entry points and external services in the composite - // Also derive properties from the overridable properties of the components in the composite - if (componentType == null) { - AssemblyFactory factory = modelContext.getAssemblyFactory(); - componentType = factory.createComponentType(); - for (EntryPoint entryPoint : getEntryPoints()) { - Service service = factory.createService(); - service.setName(entryPoint.getName()); - ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract(); - if (serviceContract != null) - service.setServiceContract(serviceContract); - componentType.getServices().add(service); - - ConfiguredReference configuredReference = entryPoint.getConfiguredReference(); - ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference); - for (String target : configuredReference.getTargets()) { - ServiceURI targetURI = factory.createServiceURI(null, target); - Wire wire = factory.createWire(); - wire.setSource(sourceURI); - wire.setTarget(targetURI); - getWires().add(wire); - } - } - for (ExternalService externalService : getExternalServices()) { - if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO) - continue; - Reference reference = factory.createReference(); - reference.setName(externalService.getName()); - ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract(); - if (serviceContract != null) - reference.setServiceContract(serviceContract); - componentType.getReferences().add(reference); - } - for (Component<Implementation> component : getComponents()) { - for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) { - if (configuredProperty.getOverrideOption() == null || configuredProperty.getOverrideOption() == OverrideOption.NO) - continue; - componentType.getProperties().add(configuredProperty.getProperty()); - } - - for (ConfiguredReference configuredReference : component.getConfiguredReferences()) { - // Create a wire - ServiceURI sourceURI = factory.createServiceURI(null, component, configuredReference); - for (String target : configuredReference.getTargets()) { - ServiceURI targetURI = factory.createServiceURI(null, target); - Wire wire = factory.createWire(); - wire.setSource(sourceURI); - wire.setTarget(targetURI); - getWires().add(wire); - } - } - } - } - componentType.initialize(modelContext); - - // Wire the parts in this composite - wire(modelContext); - } - - /** - * Wire the parts in this composite. - * @param modelContext - */ - protected void wire(AssemblyContext modelContext) { - for (Wire wire : getWires()) { - - // Get the source reference - ServiceURI sourceURI = wire.getSource(); - ConfiguredReference configuredReference = null; - String partName = sourceURI.getPartName(); - String referenceName = sourceURI.getServiceName(); - if (referenceName != null) { - //Component<?> component = (Component<?>)getPart(partName); -// if (component != null) { - Part part = getPart(partName); - if (part instanceof Component) { - configuredReference = ((Component) part).getConfiguredReference(referenceName); - } else if (part instanceof EntryPoint) { - configuredReference = ((EntryPoint) part).getConfiguredReference(); - } - } else { - EntryPoint entryPoint = (EntryPoint) getPart(partName); - if (entryPoint != null) { - configuredReference = entryPoint.getConfiguredReference(); - } - } - if (configuredReference == null) { - throw new IllegalArgumentException("Cannot find wire source " + sourceURI.getPath()); - } else { - - // Resolve the target service endpoint - ServiceURI targetURI = wire.getTarget(); - ConfiguredService configuredService = getConfiguredService(targetURI); - if (configuredService != null) { - - // Wire the reference to the target - Multiplicity multiplicity = configuredReference.getPort().getMultiplicity(); - if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { - configuredReference.getTargetConfiguredServices().add(configuredService); - } else { - configuredReference.getTargetConfiguredServices().clear(); - configuredReference.getTargetConfiguredServices().add(configuredService); - } - } else { - throw new IllegalArgumentException("Cannot find service '" + targetURI.getPath() +"'."); - } - } - } - } - - public Class<?> getImplementationClass() { - return implementationClass; - } - - public void setImplementationClass(Class<?> clazz) { - checkNotFrozen(); - this.implementationClass = clazz; - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze component type - if (componentType != null) - componentType.freeze(); - - // Freeze lists - wsdlImports = freeze(wsdlImports); - components = freeze(components); - entryPoints = freeze(entryPoints); - externalServices = freeze(externalServices); - wires = freeze(wires); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(wsdlImports, visitor)) - return false; - - if (!accept(partsMap.values(), visitor)) - return false; - - if (!accept(wires, visitor)) - return false; - - if (componentType != null) { - if (!componentType.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java deleted file mode 100644 index f1007e8c07..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.Port; - -/** - * Implementation of ConfiguredPort. - */ -public abstract class ConfiguredPortImpl<P extends Port> extends AssemblyObjectImpl implements ConfiguredPort<P> { - private String name; - private Part part; - private P port; - - private Object proxyFactory; - - protected ConfiguredPortImpl() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - checkNotFrozen(); - this.name=name; - } - - public P getPort() { - return port; - } - - public void setPort(P port) { - checkNotFrozen(); - this.port = port; - } - - public Part getPart() { - return part; - } - - public void setPart(Part part) { - checkNotFrozen(); - this.part=part; - } - - public Object getProxyFactory() { - return proxyFactory; - } - - public void setProxyFactory(Object proxyFactory) { - checkNotFrozen(); - this.proxyFactory = proxyFactory; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (port!=null) { - name=port.getName(); - port.initialize(modelContext); - } - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (port!=null) - port.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (port!=null) { - if (!port.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java deleted file mode 100644 index 4c64676451..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Property; - -/** - * Implementation of ConfiguredProperty - */ -public class ConfiguredPropertyImpl extends AssemblyObjectImpl implements ConfiguredProperty { - private String name; - private OverrideOption overrideOption; - private Object value; - private Property property; - - protected ConfiguredPropertyImpl() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Property getProperty() { - return property; - } - - public void setProperty(Property property) { - checkNotFrozen(); - this.property = property; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - checkNotFrozen(); - this.value = value; - } - - public OverrideOption getOverrideOption() { - return overrideOption; - } - - public void setOverrideOption(OverrideOption value) { - checkNotFrozen(); - this.overrideOption=value; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (property!=null) - property.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (property!=null) - property.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (property!=null) { - if (!property.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java deleted file mode 100644 index f21a5be52e..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Reference; - -/** - * An implementation of ConfiguredReference. - */ -public class ConfiguredReferenceImpl extends ConfiguredPortImpl<Reference> implements ConfiguredReference { - - private List<String> targets = new ArrayList<String>(); - - private List<ConfiguredService> targetConfiguredServices = new ArrayList<ConfiguredService>(); - - protected ConfiguredReferenceImpl() { - } - - public List<String> getTargets() { - return targets; - } - - public List<ConfiguredService> getTargetConfiguredServices() { - return targetConfiguredServices; - } - - public void freeze() { - super.freeze(); - - targetConfiguredServices = freeze(targetConfiguredServices); - targets = freeze(targets); - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java deleted file mode 100644 index 923af1882c..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of ConfiguredService. - */ -public class ConfiguredServiceImpl extends ConfiguredPortImpl<Service> implements ConfiguredService { - - protected ConfiguredServiceImpl() { - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java deleted file mode 100644 index a894a7c48f..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; - -/** - * An implementation of EntryPoint. - */ -public class EntryPointImpl extends PartImpl implements EntryPoint { - - private ConfiguredService configuredService; - private ConfiguredReference configuredReference; - private List<Binding> bindings=new ArrayList<Binding>(); - - protected EntryPointImpl() { - } - - public ConfiguredReference getConfiguredReference() { - return configuredReference; - } - - public void setConfiguredReference(ConfiguredReference configuredReference) { - checkNotFrozen(); - configuredReference.setPart(this); - this.configuredReference=configuredReference; - } - - public ConfiguredService getConfiguredService() { - return configuredService; - } - - public void setConfiguredService(ConfiguredService configuredService) { - checkNotFrozen(); - configuredService.setPart(this); - this.configuredService=configuredService; - } - - public List<Binding> getBindings() { - return bindings; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the service contract and reference to the published service - if (configuredReference != null) { - configuredReference.initialize(modelContext); - } - if (configuredService != null) { - configuredService.initialize(modelContext); - } - - // Initialize the bindings - initialize(bindings, modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze the service contract and configured reference - if (configuredReference != null) - configuredReference.freeze(); - if (configuredService != null) - configuredService.freeze(); - - // Freeze the bindings - bindings=freeze(bindings); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (configuredReference!=null) { - if (!configuredReference.accept(visitor)) - return false; - } - - if (configuredService!=null) { - if (!configuredService.accept(visitor)) - return false; - } - - if (!accept(bindings, visitor)) - return false; - - return true; - } -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java deleted file mode 100644 index 6adf66dc9e..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Extensible; - -/** - * An implementation of Extensible. - */ -public abstract class ExtensibleImpl extends AssemblyObjectImpl implements Extensible { - - private List<Object> extensibilityElements = new ArrayList<Object>(); - private List<Object> extensibilityAttributes = new ArrayList<Object>(); - - protected ExtensibleImpl() { - } - - public List<Object> getExtensibilityElements() { - return extensibilityElements; - } - - public List<Object> getExtensibilityAttributes() { - return extensibilityAttributes; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize extensibility elements and attributes - initialize(extensibilityElements, modelContext); - initialize(extensibilityAttributes, modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze extensibility elements and attributes - freeze(extensibilityElements); - freeze(extensibilityAttributes); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(extensibilityElements, visitor)) - return false; - return accept(extensibilityAttributes, visitor); - - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java deleted file mode 100644 index 9110731c34..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.OverrideOption; - -/** - * An implementation ExternalService. - */ -public class ExternalServiceImpl extends PartImpl implements ExternalService { - - private ConfiguredService configuredService; - private OverrideOption overrideOption; - private List<Binding> bindings=new ArrayList<Binding>(); - - private Object contextFactory; - - protected ExternalServiceImpl() { - } - - public OverrideOption getOverrideOption() { - return overrideOption; - } - - public void setOverrideOption(OverrideOption newOverridable) { - checkNotFrozen(); - overrideOption=newOverridable; - } - - public List<Binding> getBindings() { - return bindings; - } - - public ConfiguredService getConfiguredService() { - return configuredService; - } - - public void setConfiguredService(ConfiguredService configuredService) { - checkNotFrozen(); - configuredService.setPart(this); - this.configuredService=configuredService; - } - - public Object getContextFactory() { - return contextFactory; - } - - public void setContextFactory(Object contextFactory) { - this.contextFactory=contextFactory; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the configured service - if (configuredService != null) { - configuredService.initialize(modelContext); - } - - // Initialize the bindings - initialize(bindings, modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze the configured service - if (configuredService!= null) - configuredService.freeze(); - - // Freeze the bindings - bindings=freeze(bindings); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (configuredService!=null) { - if (!configuredService.accept(visitor)) - return false; - } - - if (!accept(bindings, visitor)) - return false; - - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java deleted file mode 100644 index a44d80cc66..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Implementation; - -/** - * An implementation of Implementation. - */ -public abstract class ImplementationImpl extends ExtensibleImpl implements Implementation { - - private ComponentType componentType; - - public ComponentType getComponentType() { - return componentType; - } - - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType=componentType; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the component type - if (componentType!=null) { - componentType.initialize(modelContext); - } - - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (componentType!=null) - componentType.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (componentType!=null) { - if (!componentType.accept(visitor)) - return false; - } - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java deleted file mode 100644 index 56aedd18f5..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.net.URL; - -import javax.wsdl.Definition; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ImportWSDL; - -/** - * Implementation of ImportWSDL. - * - * @version $Rev$ $Date$ - */ -public class ImportWSDLImpl extends AssemblyObjectImpl implements ImportWSDL { - private String location; - private String namespace; - private Definition definition; - - protected ImportWSDLImpl() { - } - - public String getLocation() { - return location; - } - - public void setLocation(String uri) { - checkNotFrozen(); - this.location = uri; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String uri) { - checkNotFrozen(); - this.namespace = uri; - } - - public Definition getDefinition() { - return definition; - } - - public void setDefinition(Definition definition) { - checkNotFrozen(); - this.definition = definition; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Load the WSDL definition if necessary - ResourceLoader resourceLoader = modelContext.getApplicationResourceLoader(); - if (definition == null) { - URL url = resourceLoader.getResource(location); - if (url == null) - throw new IllegalArgumentException("Cannot find " + location); - definition = modelContext.getAssemblyLoader().loadDefinition(url.toString()); - } - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java deleted file mode 100644 index 60cb42a981..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; - -/** - * An implementation of ModuleComponent. - */ -public class ModuleComponentImpl extends ComponentImpl<Module> implements ModuleComponent { - - private String uri; - - protected ModuleComponentImpl() { - } - - public String getURI() { - return uri; - } - - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java deleted file mode 100644 index 08536d23b8..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ModuleFragment; - -/** - * An implementation of ModuleFragment. - */ -public class ModuleFragmentImpl extends CompositeImpl implements ModuleFragment { - - protected ModuleFragmentImpl() { - } - - protected void wire(AssemblyContext modelContext) { - // No wiring inside a module fragment - // Wires are handled at the module level - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java deleted file mode 100644 index f64317ac86..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of Module. - */ -public class ModuleImpl extends CompositeImpl implements Module { - - /** - * A list of module fragments synchronized with a map - */ - private class ModuleFragmentList<E extends ModuleFragment> extends NotifyingList<E> { - protected void added(E element) { - moduleFragmentsMap.put(element.getName(), element); - } - - protected void removed(E element) { - moduleFragmentsMap.remove(element.getName()); - } - } - - private List<ModuleFragment> moduleFragments = new ModuleFragmentList<ModuleFragment>(); - private Map<String, ModuleFragment> moduleFragmentsMap = new HashMap<String, ModuleFragment>(); - - /** - * Constructor - */ - protected ModuleImpl() { - } - - public List<ModuleFragment> getModuleFragments() { - return moduleFragments; - } - - public ModuleFragment getModuleFragment(String name) { - checkInitialized(); - return moduleFragmentsMap.get(name); - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - - // Initialize module fragments - for (ModuleFragment moduleFragment : moduleFragments) { - - // Add all WSDL imports, components, entry points and external services from the module fragments - getWSDLImports().addAll(moduleFragment.getWSDLImports()); - getComponents().addAll(moduleFragment.getComponents()); - getEntryPoints().addAll(moduleFragment.getEntryPoints()); - getExternalServices().addAll(moduleFragment.getExternalServices()); - - // Add all the wires from the module fragments - getWires().addAll(moduleFragment.getWires()); - - moduleFragment.initialize(modelContext); - } - - // Initialize the composite - super.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - moduleFragments = freeze(moduleFragments); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - return accept(moduleFragments, visitor); - - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java deleted file mode 100644 index 3743c7505b..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.Part; - -/** - * Implementation of Part. - */ -public abstract class PartImpl extends ExtensibleImpl implements Part { - private Composite composite; - private String name; - - private Object contextFactory; - - protected PartImpl() { - } - - public String getName() { - return name; - } - - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - public Composite getComposite() { - return composite; - } - - public void setComposite(Composite composite) { - checkNotFrozen(); - this.composite=composite; - } - - public Object getContextFactory() { - return contextFactory; - } - - public void setContextFactory(Object contextFactory) { - checkNotFrozen(); - this.contextFactory=contextFactory; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java deleted file mode 100644 index c11cee590a..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Port; -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * An implementation of Port. - */ -public abstract class PortImpl extends AssemblyObjectImpl implements Port { - - private ServiceContract serviceContract; - private String name; - - protected PortImpl() { - } - - public String getName() { - return name; - } - - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - public ServiceContract getServiceContract() { - return serviceContract; - } - - public void setServiceContract(ServiceContract value) { - checkNotFrozen(); - serviceContract=value; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (serviceContract!=null) - serviceContract.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (serviceContract!=null) - serviceContract.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (serviceContract!=null) { - if (!serviceContract.accept(visitor)) - return false; - } - - return true; - } -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java deleted file mode 100644 index e91245504b..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Property; - -/** - * An implementation of Property. - */ -public class PropertyImpl extends ExtensibleImpl implements Property { - - private Object defaultValue; - private String name; - private boolean many; - private boolean required; - private Class<?> type; - - protected PropertyImpl() { - } - - public Object getDefaultValue() { - return defaultValue; - } - - public String getName() { - return name; - } - - public Class<?> getType() { - return type; - } - - public boolean isMany() { - return many; - } - - public boolean isRequired() { - return required; - } - - public void setDefaultValue(Object value) { - checkNotFrozen(); - defaultValue = value; - } - - public void setMany(boolean value) { - checkNotFrozen(); - many = value; - } - - public void setName(String value) { - checkNotFrozen(); - name = value; - } - - public void setRequired(boolean value) { - checkNotFrozen(); - required = value; - } - - public void setType(Class<?> value) { - checkNotFrozen(); - type = value; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java deleted file mode 100644 index 1a064e5092..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; - -/** - * An implementation of Reference. - */ -public class ReferenceImpl extends PortImpl implements Reference { - - private Multiplicity multiplicity; - - protected ReferenceImpl() { - } - - public Multiplicity getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(Multiplicity multiplicity) { - checkNotFrozen(); - this.multiplicity=multiplicity; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java deleted file mode 100644 index f71702792b..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * An implementation of ServiceContract. - */ -public class ServiceContractImpl extends ExtensibleImpl implements ServiceContract { - - private Class interface_; - private Class callbackInterface; - private Scope scope; - - protected ServiceContractImpl() { - } - - public Class getCallbackInterface() { - return callbackInterface; - } - - public Class getInterface() { - return interface_; - } - - public Scope getScope() { - return scope; - } - - public void setCallbackInterface(Class value) { - checkNotFrozen(); - callbackInterface=value; - } - - public void setInterface(Class value) { - checkNotFrozen(); - interface_=value; - } - - public void setScope(Scope scope) { - checkNotFrozen(); - this.scope=scope; - } -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java deleted file mode 100644 index d1432d0149..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of Service. - */ -public class ServiceImpl extends PortImpl implements Service { - - protected ServiceImpl() { - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java deleted file mode 100644 index ef180814ff..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java +++ /dev/null @@ -1,210 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceURI; - -/** - * An implementation of ServiceURI. - */ -public class ServiceURIImpl implements ServiceURI { - - private String address; - private Boolean isSCAScheme; - private boolean isParsed; - private String moduleComponentName; - private String partName; - private String serviceName; - - /** - * Constructs a new ServiceURIImpl. - * @param address - */ - protected ServiceURIImpl(String address) { - this.address = address; - } - - /** - * Constructs a new ServiceURIImpl. - * @param moduleComponent - * @param partName - * @param portName - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, String partName, String portName) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - this.partName = partName; - this.serviceName = portName; - } - - /** - * Constructs a new ServiceURIImpl. - * @param moduleComponent - * @param configuredPort - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - if (configuredPort instanceof ConfiguredService) { - partName = part.getName(); - ConfiguredService configuredService = (ConfiguredService) configuredPort; - Service service = configuredService.getPort(); - if (service != null) { - serviceName = configuredService.getPort().getName(); - address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; - } else { - address = "sca:///" + moduleComponentName + '/' + partName; - } - - } else if (configuredPort instanceof ConfiguredReference) { - ConfiguredReference configuredReference = (ConfiguredReference) configuredPort; - partName = part.getName(); - serviceName = configuredReference.getPort().getName(); - if (serviceName!=null) - address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; - else - address = "sca:///" + moduleComponentName + '/' + partName; - } - - isSCAScheme = Boolean.TRUE; - isParsed = true; - } - - /** - * Constructor - * - * @param moduleComponent - * @param targetServiceName - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, String targetServiceName) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - int s = targetServiceName.indexOf('/'); - if (s == -1) { - partName = targetServiceName; - address = "sca:///" + moduleComponentName + '/' + partName; - } else { - partName = targetServiceName.substring(0, s); - this.serviceName = targetServiceName.substring(s + 1); - address = "sca:///" + moduleComponentName + '/' + partName + '/' + this.serviceName; - } - isSCAScheme = Boolean.TRUE; - isParsed = true; - } - - public boolean isSCAScheme() { - if (isSCAScheme == null) { - if (address != null && address.startsWith("sca://")) { - isSCAScheme = Boolean.TRUE; - } else { - isSCAScheme = Boolean.FALSE; - } - } - return isSCAScheme.booleanValue(); - } - - public String getAddress() { - return address; - } - - public String getPath() { - StringBuffer path = new StringBuffer(); - String mc = getModuleComponentName(); - if (mc != null) { - path.append(mc); - } - String p = getPartName(); - if (p !=null) { - if (path.length()!=0) - path.append('/'); - path.append(p); - } - String s = getServiceName(); - if (s !=null) { - if (path.length()!=0) - path.append('/'); - path.append(s); - } - return path.toString(); - } - - /** - * Parse the address. - */ - private void parse() { - isParsed = true; - if (isSCAScheme()) { - int s1 = address.indexOf('/', 6); - if (s1 == -1) - return; - s1++; - int s2 = address.indexOf('/', s1); - if (s2 == -1) - return; - moduleComponentName = address.substring(s1, s2); - s2++; - int s3 = address.indexOf('/', s2); - if (s3 == -1) { - partName = address.substring(s2); - return; - } - partName = address.substring(s2, s3); - s3++; - serviceName = address.substring(s3); - } - } - - /** - * Returns the module component name - */ - public String getModuleComponentName() { - if (!isParsed) - parse(); - return moduleComponentName; - } - - /** - * Returns the part name - */ - public String getPartName() { - if (!isParsed) - parse(); - return partName; - } - - /** - * Returns the service name - */ - public String getServiceName() { - if (!isParsed) - parse(); - return serviceName; - } - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java deleted file mode 100644 index 334e34ba5b..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Subsystem; - -/** - * An implementation of Subsystem. - */ -public class SubsystemImpl extends CompositeImpl implements Subsystem { - - private String uri; - - protected SubsystemImpl() { - } - - public String getURI() { - return uri; - } - - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - - public ComponentType getComponentType() { - //TODO implement - return null; - } - - public void setComponentType(ComponentType componentType) { - } - - - -} diff --git a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java b/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java deleted file mode 100644 index c7c4bda7a1..0000000000 --- a/tags/java-M1-final/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.Wire; - -/** - * An implementation of Wire. - */ -public class WireImpl extends ExtensibleImpl implements Wire { - - private ServiceURI source; - private ServiceURI target; - - protected WireImpl() { - } - - public ServiceURI getSource() { - return source; - } - - public void setSource(ServiceURI uri) { - checkNotFrozen(); - source=uri; - } - - public ServiceURI getTarget() { - return target; - } - - public void setTarget(ServiceURI uri) { - checkNotFrozen(); - target=uri; - } - -} |