You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/02/21 07:54:10 UTC
svn commit: r379376 [2/11] - in /incubator/tuscany/java/sca/model: ./
src/main/java/org/apache/tuscany/model/
src/main/java/org/apache/tuscany/model/assembly/
src/main/java/org/apache/tuscany/model/assembly/impl/
src/main/java/org/apache/tuscany/model/...
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+
+/**
+ * Represents service contract.
+ */
+public interface ServiceContract extends Extensible {
+
+ /**
+ * Returns the interface.
+ * @return
+ */
+ Class getInterface();
+
+ /**
+ * Sets the interface.
+ * @param value
+ */
+ void setInterface(Class value);
+
+ /**
+ * Returns the callback interface.
+ * @return
+ */
+ Class getCallbackInterface();
+
+ /**
+ * Sets the callback interface.
+ * @param value
+ */
+ void setCallbackInterface(Class value);
+
+ /**
+ * Returns the scope of this service contract.
+ * @return
+ */
+ Scope getScope();
+
+ /**
+ * Sets the scope.
+ * @param scope of this service contract.
+ */
+ void setScope(Scope scope);
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,53 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+/**
+ * Represents a service URI.
+ */
+public interface ServiceURI {
+
+ /**
+ * Returns true if the address scheme is sca
+ * @return
+ */
+ public boolean isSCAScheme();
+
+ /**
+ * @return Returns the address.
+ */
+ public String getAddress();
+
+ /**
+ * Returns the module component name
+ * @return
+ */
+ public String getModuleComponentName();
+
+ /**
+ * Returns the part name
+ * @return
+ */
+ public String getPartName();
+
+ /**
+ * Returns the service name
+ * @return
+ */
+ public String getServiceName();
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/SimpleComponent.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/SimpleComponent.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/SimpleComponent.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/SimpleComponent.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * Represents a simple component (as opposed to a component implemented by an aggregate, like a module component)
+ */
+public interface SimpleComponent extends Component {
+
+}
+
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/SimpleComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/SimpleComponent.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+
+/**
+ * Represents a subsystem.
+ */
+public interface Subsystem extends Aggregate {
+
+ /**
+ * Returns the subsystem uri.
+ * @return
+ */
+ String getURI();
+
+ /**
+ * Sets the subsystem uri.
+ * @param value
+ */
+ void setURI(String value);
+
+} // Subsystem
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,214 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.Aggregate;
+import org.apache.tuscany.model.assembly.AggregatePart;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.ServiceURI;
+
+/**
+ * An implementation of Aggregate.
+ */
+public abstract class AggregateImpl extends ExtensibleImpl implements Aggregate {
+
+ private String name;
+ private List<Component> components=new ArrayList<Component>();
+ private Map<String, Component> componentsMap;
+ private List<EntryPoint> entryPoints=new ArrayList<EntryPoint>();
+ private Map<String, EntryPoint> entryPointsMap;
+ private List<ExternalService> externalServices=new ArrayList<ExternalService>();
+ private Map<String, ExternalService> externalServicesMap;
+ private List<AggregatePart> aggregateParts;
+
+ /**
+ * Constructor
+ */
+ protected AggregateImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#setName(java.lang.String)
+ */
+ public void setName(String newName) {
+ checkNotFrozen();
+ name=newName;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getComponents()
+ */
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getComponent(java.lang.String)
+ */
+ public Component getComponent(String name) {
+ checkInitialized();
+ return componentsMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getEntryPoints()
+ */
+ public List<EntryPoint> getEntryPoints() {
+ return entryPoints;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getEntryPoint(java.lang.String)
+ */
+ public EntryPoint getEntryPoint(String name) {
+ checkInitialized();
+ return entryPointsMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getExternalServices()
+ */
+ public List<ExternalService> getExternalServices() {
+ return externalServices;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getExternalService(java.lang.String)
+ */
+ public ExternalService getExternalService(String name) {
+ checkInitialized();
+ return externalServicesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getAggregateParts()
+ */
+ public List<AggregatePart> getAggregateParts() {
+ checkInitialized();
+ return aggregateParts;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Aggregate#getConfiguredService(org.apache.tuscany.model.assembly.ServiceURI)
+ */
+ public ConfiguredService getConfiguredService(ServiceURI address) {
+ String partName = address.getPartName();
+ String serviceName = address.getServiceName();
+ Component component = getComponent(partName);
+ if (component != null) {
+ if (serviceName != null) {
+ return component.getConfiguredService(serviceName);
+ } else {
+ if (!component.getConfiguredServices().isEmpty()) {
+ return component.getConfiguredServices().get(0);
+ } else {
+ return null;
+ }
+ }
+
+ } else {
+ ExternalService externalService = getExternalService(partName);
+ if (externalService != null) {
+ return externalService.getConfiguredService();
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Populate maps of components, entry points and external services
+ aggregateParts = new ArrayList<AggregatePart>();
+ componentsMap = new HashMap<String, Component>();
+ for (Component component : components) {
+ componentsMap.put(component.getName(), component);
+ aggregateParts.add(component);
+ component.initialize(modelContext);
+ ((AggregatePartImpl)component).setAggregate(this);
+ }
+ entryPointsMap = new HashMap<String, EntryPoint>();
+ for (EntryPoint entryPoint : entryPoints) {
+ entryPointsMap.put(entryPoint.getName(), entryPoint);
+ aggregateParts.add(entryPoint);
+ entryPoint.initialize(modelContext);
+ ((AggregatePartImpl)entryPoint).setAggregate(this);
+ }
+ externalServicesMap = new HashMap<String, ExternalService>();
+ for (ExternalService externalService : externalServices) {
+ externalServicesMap.put(externalService.getName(), externalService);
+ aggregateParts.add(externalService);
+ externalService.initialize(modelContext);
+ ((AggregatePartImpl)externalService).setAggregate(this);
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze lists
+ components=Collections.unmodifiableList(components);
+ freeze(components);
+ entryPoints=Collections.unmodifiableList(entryPoints);
+ freeze(entryPoints);
+ externalServices=Collections.unmodifiableList(externalServices);
+ freeze(externalServices);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(aggregateParts, visitor))
+ return false;
+
+ return true;
+ }
+
+} //ModuleImpl
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,67 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.Aggregate;
+import org.apache.tuscany.model.assembly.AggregatePart;
+
+/**
+ * Implementation of AggregatePart.
+ */
+public abstract class AggregatePartImpl extends ExtensibleImpl implements AggregatePart {
+ private Aggregate aggregate;
+ private String name;
+
+ /**
+ * Constructor
+ */
+ protected AggregatePartImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AggregatePart#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AggregatePart#setName(java.lang.String)
+ */
+ public void setName(String value) {
+ checkNotFrozen();
+ name=value;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AggregatePart#getAggregate()
+ */
+ public Aggregate getAggregate() {
+ checkInitialized();
+ return aggregate;
+ }
+
+ /**
+ * Sets the aggregate containing this aggregate part.
+ * @param aggregate
+ */
+ protected void setAggregate(Aggregate aggregate) {
+ checkNotFrozen();
+ this.aggregate=aggregate;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregatePartImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,195 @@
+/**
+ *
+ * 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.AssemblyFactory;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.ConfiguredPort;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.ModuleFragment;
+import org.apache.tuscany.model.assembly.Property;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceURI;
+import org.apache.tuscany.model.assembly.SimpleComponent;
+import org.apache.tuscany.model.assembly.Subsystem;
+import org.apache.tuscany.model.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;
+
+/**
+ */
+public class AssemblyFactoryImpl implements AssemblyFactory {
+
+ /**
+ * Constructor
+ */
+ public AssemblyFactoryImpl() {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createSimpleComponent()
+ */
+ public SimpleComponent createSimpleComponent() {
+ return new SimpleComponentImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createComponentType()
+ */
+ public ComponentType createComponentType() {
+ return new ComponentTypeImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createEntryPoint()
+ */
+ public EntryPoint createEntryPoint() {
+ return new EntryPointImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createExternalService()
+ */
+ public ExternalService createExternalService() {
+ return new ExternalServiceImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createJavaServiceContract()
+ */
+ public JavaServiceContract createJavaServiceContract() {
+ return new JavaServiceContractImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createModule()
+ */
+ public Module createModule() {
+ return new ModuleImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createModuleFragment()
+ */
+ public ModuleFragment createModuleFragment() {
+ return new ModuleFragmentImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createModuleComponent()
+ */
+ public ModuleComponent createModuleComponent() {
+ return new ModuleComponentImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createProperty()
+ */
+ public Property createProperty() {
+ return new PropertyImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createConfiguredProperty()
+ */
+ public ConfiguredProperty createConfiguredProperty() {
+ return new ConfiguredPropertyImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createReference()
+ */
+ public Reference createReference() {
+ return new ReferenceImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createConfiguredReference()
+ */
+ public ConfiguredReference createConfiguredReference() {
+ return new ConfiguredReferenceImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createService()
+ */
+ public Service createService() {
+ return new ServiceImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createConfiguredService()
+ */
+ public ConfiguredService createConfiguredService() {
+ return new ConfiguredServiceImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createSubsystem()
+ */
+ public Subsystem createSubsystem() {
+ return new SubsystemImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createWSDLServiceContract()
+ */
+ public WSDLServiceContract createWSDLServiceContract() {
+ return new WSDLServiceContractImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createServiceURI(java.lang.String)
+ */
+ public ServiceURI createServiceURI(String uri) {
+ return new ServiceURIImpl(uri);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createServiceURI(org.apache.tuscany.model.assembly.ModuleComponent, java.lang.String)
+ */
+ public ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName) {
+ return new ServiceURIImpl(moduleComponent, serviceName);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createServiceURI(org.apache.tuscany.model.assembly.ModuleComponent, org.apache.tuscany.model.assembly.ConfiguredPort)
+ */
+ public ServiceURI createServiceURI(ModuleComponent moduleComponent, ConfiguredPort portEndpoint) {
+ return new ServiceURIImpl(moduleComponent, portEndpoint);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyFactory#createQName(java.lang.String)
+ */
+ public QName createQName(String uri) {
+ int h = uri.indexOf('#');
+ return new QName(uri.substring(0, h), uri.substring(h + 1));
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,63 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.common.resource.loader.ResourceLoader;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.loader.AssemblyLoader;
+
+/**
+ */
+public class AssemblyModelContextImpl implements AssemblyModelContext {
+
+ private AssemblyFactory assemblyFactory;
+ private AssemblyLoader assemblyLoader;
+ private ResourceLoader resourceLoader;
+
+ /**
+ * Constructor
+ *
+ * @param resourceLoader
+ */
+ public AssemblyModelContextImpl(AssemblyLoader assemblyLoader, ResourceLoader resourceLoader) {
+ this.resourceLoader = resourceLoader;
+ this.assemblyLoader = assemblyLoader;
+ assemblyFactory = new AssemblyFactoryImpl();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getAssemblyFactory()
+ */
+ public AssemblyFactory getAssemblyFactory() {
+ return assemblyFactory;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getResourceLoader()
+ */
+ public ResourceLoader getResourceLoader() {
+ return resourceLoader;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelContext#getAssemblyLoader()
+ */
+ public AssemblyLoader getAssemblyLoader() {
+ return assemblyLoader;
+ }
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelContextImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,132 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.Collection;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+
+/**
+ * A base class for assembly model objects.
+ */
+public abstract class AssemblyModelObjectImpl implements AssemblyModelObject {
+
+ private boolean frozen;
+ private boolean initialized;
+
+ /**
+ * Constructor
+ */
+ protected AssemblyModelObjectImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ return visitor.visit(this);
+ }
+
+ /**
+ * Walk a visitor through a collection of model objects.
+ * @param collection
+ * @param visitor
+ * @return
+ */
+ protected boolean accept(Collection collection, AssemblyModelVisitor visitor) {
+ for (Object member : collection) {
+ if (member instanceof AssemblyModelObject) {
+ if (!((AssemblyModelObject)member).accept(visitor))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze()
+ */
+ public void freeze() {
+ if (!frozen)
+ frozen=true;
+ }
+
+ /**
+ * Returns true if the object is frozen
+ */
+ protected boolean isFrozen() {
+ return frozen;
+ }
+
+ /**
+ * Freeze members of a collection
+ */
+ protected void freeze(Collection collection) {
+ for (Object member : collection) {
+ if (member instanceof AssemblyModelObject) {
+ ((AssemblyModelObject)member).freeze();
+ }
+ }
+ }
+
+ /**
+ * Check that the current model object can be modified.
+ * @throws IllegalStateException
+ */
+ protected void checkNotFrozen() {
+ if (frozen)
+ throw new IllegalStateException("Attempt to modify a frozen assembly model");
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (!initialized)
+ initialized=true;
+ }
+
+ /**
+ * Returns true if the object is initialized
+ */
+ protected boolean isInitialized() {
+ return initialized;
+ }
+
+ /**
+ * Initialize members of a collection
+ */
+ protected void initialize(Collection collection, AssemblyModelContext modelContext) {
+ for (Object member : collection) {
+ if (member instanceof AssemblyModelObject) {
+ ((AssemblyModelObject)member).initialize(modelContext);
+ }
+ }
+ }
+
+ /**
+ * Check that the current model object is initialized.
+ * @throws IllegalStateException
+ */
+ protected void checkInitialized() {
+ if (!initialized)
+ throw new IllegalStateException("Attempt to use an uninitialized assembly model");
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyModelObjectImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,96 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.Binding;
+
+/**
+ * An implementation of Binding.
+ */
+public class BindingImpl extends ExtensibleImpl implements Binding {
+
+ private String uri;
+ private Object runtimeConfiguration;
+
+ /**
+ * Constructor
+ */
+ protected BindingImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Binding#getURI()
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Binding#setURI(java.lang.String)
+ */
+ public void setURI(String value) {
+ checkNotFrozen();
+ uri=value;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration()
+ */
+ public Object getRuntimeConfiguration() {
+ return runtimeConfiguration;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object)
+ */
+ public void setRuntimeConfiguration(Object configuration) {
+ checkNotFrozen();
+ this.runtimeConfiguration = configuration;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AggregateImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,234 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.ComponentImplementation;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+
+/**
+ * An implementation of Component.
+ */
+public class ComponentImpl extends AggregatePartImpl implements Component {
+
+ private List<ConfiguredReference> configuredReferences;
+ private Map<String, ConfiguredReference> configuredReferencesMap;
+ private List<ConfiguredService> configuredServices;
+ private Map<String, ConfiguredService> configuredServicesMap;
+ private List<ConfiguredProperty> configuredProperties;
+ private Map<String, ConfiguredProperty> configuredPropertiesMap;
+ private ComponentImplementation implementation;
+
+ /**
+ * Constructor
+ */
+ protected ComponentImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#getComponentImplementation()
+ */
+ public ComponentImplementation getComponentImplementation() {
+ return implementation;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#setComponentImplementation(org.apache.tuscany.model.assembly.ComponentImplementation)
+ */
+ public void setComponentImplementation(ComponentImplementation value) {
+ checkNotFrozen();
+ implementation=value;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#getConfiguredServices()
+ */
+ public List<ConfiguredService> getConfiguredServices() {
+ checkInitialized();
+ return configuredServices;
+ }
+
+ public ConfiguredService getConfiguredService(String name) {
+ checkInitialized();
+ return configuredServicesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#getConfiguredReferences()
+ */
+ public List<ConfiguredReference> getConfiguredReferences() {
+ checkInitialized();
+ return configuredReferences;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#getConfiguredReference(java.lang.String)
+ */
+ public ConfiguredReference getConfiguredReference(String name) {
+ checkInitialized();
+ return configuredReferencesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#getConfiguredProperties()
+ */
+ public List<ConfiguredProperty> getConfiguredProperties() {
+ checkInitialized();
+ return configuredProperties;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Component#getConfiguredProperty(java.lang.String)
+ */
+ public ConfiguredProperty getConfiguredProperty(String name) {
+ checkInitialized();
+ return configuredPropertiesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize the implementation
+ ComponentImplementation implementation = getComponentImplementation();
+ if (implementation != null) {
+ implementation.initialize(modelContext);
+ }
+
+ // Derive the configured services, references and properties from the component implementation
+ configuredServices = new ArrayList<ConfiguredService>();
+ configuredServicesMap = new HashMap<String, ConfiguredService>();
+ configuredReferences = new ArrayList<ConfiguredReference>();
+ configuredReferencesMap = new HashMap<String, ConfiguredReference>();
+ configuredProperties = new ArrayList<ConfiguredProperty>();
+ configuredPropertiesMap = new HashMap<String, ConfiguredProperty>();
+ if (implementation != null) {
+ AssemblyFactory factory = modelContext.getAssemblyFactory();
+ for (Service service : implementation.getComponentType().getServices()) {
+ ConfiguredService configuredService = factory.createConfiguredService();
+ configuredService.setPort(service);
+ configuredServices.add(configuredService);
+ configuredServicesMap.put(service.getName(), configuredService);
+ ((ConfiguredPortImpl)configuredService).setAggregatePart(this);
+ configuredService.initialize(modelContext);
+ }
+
+ for (Reference reference : implementation.getComponentType().getReferences()) {
+ ConfiguredReference configuredReference = factory.createConfiguredReference();
+ configuredReference.setPort(reference);
+ configuredReferences.add(configuredReference);
+ configuredReferencesMap.put(reference.getName(), configuredReference);
+ ((ConfiguredPortImpl)configuredReference).setAggregatePart(this);
+ configuredReference.initialize(modelContext);
+ }
+
+ // Populate property values map
+ //TODO Fix this
+// if (super.getPropertyValues() != null) {
+// Sequence sequence = super.getPropertyValues().getAny();
+// for (int p = 0, n = sequence.size(); p < n; p++) {
+//
+// // Get each property value element
+// commonj.sdo.Property propertyElementDef = sequence.getProperty(p);
+// DataObject propertyElement = (DataObject) sequence.getValue(p);
+//
+// // Get the corresponding property definition
+// String propertyName = propertyElementDef.getName();
+// Property property = implementation.getProperty(propertyName);
+// if (property == null) {
+// throw new IllegalArgumentException("Undefined property " + propertyName);
+// }
+//
+// // Create a property value object
+// ConfiguredProperty propertyValue = factory.createConfiguredProperty();
+// propertyValue.setComponent(this);
+// propertyValue.setProperty(property);
+//
+// // Get the property value text and convert to the expected java type
+// Sequence text = propertyElement.getSequence(0);
+// if (text != null && text.size() != 0) {
+// Object rawValue = text.getValue(0);
+// propertyValue.setValue(rawValue);
+// }
+//
+// // Add the property value object to the map
+// configuredProperties.add(propertyValue);
+// configuredPropertiesMap.put(propertyName, propertyValue);
+// }
+// }
+
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze configured services, references and properties
+ configuredServices=Collections.unmodifiableList(configuredServices);
+ freeze(configuredServices);
+ configuredReferences=Collections.unmodifiableList(configuredReferences);
+ freeze(configuredReferences);
+ configuredProperties=Collections.unmodifiableList(configuredProperties);
+ freeze(configuredProperties);
+ if (implementation!=null)
+ implementation.freeze();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(configuredServices, visitor))
+ return false;
+ if (!accept(configuredReferences, visitor))
+ return false;
+ if (!accept(configuredProperties, visitor))
+ return false;
+ if (implementation!=null) {
+ if (!implementation.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,108 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.ComponentImplementation;
+import org.apache.tuscany.model.assembly.ComponentType;
+
+/**
+ * An implementation of ComponentImplementation.
+ */
+public class ComponentImplementationImpl extends ExtensibleImpl implements ComponentImplementation {
+
+ private ComponentType componentType;
+ private Object runtimeConfiguration;
+
+ /**
+ * Constructor
+ */
+ protected ComponentImplementationImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentImplementation#getComponentType()
+ */
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentImplementation#setComponentType(org.apache.tuscany.model.assembly.ComponentType)
+ */
+ public void setComponentType(ComponentType componentType) {
+ checkNotFrozen();
+ this.componentType=componentType;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ if (componentType!=null)
+ componentType.initialize(modelContext);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze component type
+ if (componentType!=null)
+ componentType.freeze();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration()
+ */
+ public Object getRuntimeConfiguration() {
+ return runtimeConfiguration;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object)
+ */
+ public void setRuntimeConfiguration(Object configuration) {
+ checkNotFrozen();
+ this.runtimeConfiguration = configuration;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AggregateImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (componentType!=null) {
+ if (!componentType.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImplementationImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,152 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.Property;
+import org.apache.tuscany.model.assembly.Reference;
+import org.apache.tuscany.model.assembly.Service;
+
+/**
+ * An implementation of ComponentType.
+ */
+public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType {
+
+ private List<Reference> references=new ArrayList<Reference>();
+ private Map<String, Reference> referencesMap;
+ private List<Service> services=new ArrayList<Service>();
+ private Map<String, Service> servicesMap;
+ private List<Property> properties=new ArrayList<Property>();
+ private Map<String, Property> propertiesMap;
+
+ /**
+ * Constructor
+ */
+ protected ComponentTypeImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentType#getReferences()
+ */
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentType#getReference(java.lang.String)
+ */
+ public Reference getReference(String name) {
+ checkInitialized();
+ return referencesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentType#getServices()
+ */
+ public List<Service> getServices() {
+ return services;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentType#getService(java.lang.String)
+ */
+ public Service getService(String name) {
+ checkInitialized();
+ return servicesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentType#getProperties()
+ */
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ComponentType#getProperty(java.lang.String)
+ */
+ public Property getProperty(String name) {
+ checkInitialized();
+ return propertiesMap.get(name);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Populate maps of references, properties and services
+ referencesMap = new HashMap<String, Reference>();
+ for (Reference reference : references) {
+ referencesMap.put(reference.getName(), reference);
+ reference.initialize(modelContext);
+ }
+ propertiesMap = new HashMap<String, Property>();
+ for (Property property : properties) {
+ propertiesMap.put(property.getName(), property);
+ property.initialize(modelContext);
+ }
+ servicesMap = new HashMap<String, Service>();
+ for (Service service : services) {
+ servicesMap.put(service.getName(), service);
+ service.initialize(modelContext);
+ }
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze lists of services, references and properties
+ services=Collections.unmodifiableList(services);
+ freeze(services);
+ references=Collections.unmodifiableList(references);
+ freeze(references);
+ properties=Collections.unmodifiableList(properties);
+ freeze(properties);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(services, visitor))
+ return false;
+ if (!accept(references, visitor))
+ return false;
+ if (!accept(properties, visitor))
+ return false;
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,142 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AggregatePart;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.ConfiguredPort;
+import org.apache.tuscany.model.assembly.Port;
+
+/**
+ * Implementation of ConfiguredPort.
+ */
+public abstract class ConfiguredPortImpl extends AssemblyModelObjectImpl implements ConfiguredPort {
+ private AggregatePart aggregatePart;
+ private Port port;
+
+ private Object runtimeConfiguration;
+ private Object proxyFactory;
+
+ /**
+ * Constructor
+ */
+ protected ConfiguredPortImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredPort#getPort()
+ */
+ public Port getPort() {
+ return port;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredPort#setPort(org.apache.tuscany.model.assembly.Port)
+ */
+ public void setPort(Port port) {
+ checkNotFrozen();
+ this.port = port;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredPort#getAggregatePart()
+ */
+ public AggregatePart getAggregatePart() {
+ checkInitialized();
+ return aggregatePart;
+ }
+
+ /**
+ * Sets the aggregate part containing this configured port.
+ * @param aggregatePart
+ */
+ protected void setAggregatePart(AggregatePart aggregatePart) {
+ checkNotFrozen();
+ this.aggregatePart=aggregatePart;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredPort#getProxyFactory()
+ */
+ public Object getProxyFactory() {
+ return proxyFactory;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredPort#setProxyFactory(java.lang.Object)
+ */
+ public void setProxyFactory(Object proxyFactory) {
+ checkNotFrozen();
+ this.proxyFactory = proxyFactory;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#getRuntimeConfiguration()
+ */
+ public Object getRuntimeConfiguration() {
+ return runtimeConfiguration;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.RuntimeConfigurationHolder#setRuntimeConfiguration(java.lang.Object)
+ */
+ public void setRuntimeConfiguration(Object configuration) {
+ checkNotFrozen();
+ runtimeConfiguration = configuration;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ if (port!=null)
+ port.initialize(modelContext);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ if (port!=null)
+ port.freeze();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (port!=null) {
+ if (!port.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,106 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.ConfiguredProperty;
+import org.apache.tuscany.model.assembly.Property;
+
+/**
+ * Implementation of ConfiguredProperty
+ */
+public class ConfiguredPropertyImpl extends AssemblyModelObjectImpl implements ConfiguredProperty {
+ private Property property;
+ private Object value;
+
+ /**
+ * Constructor
+ */
+ protected ConfiguredPropertyImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredProperty#getProperty()
+ */
+ public Property getProperty() {
+ return property;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredProperty#setProperty(org.apache.tuscany.model.assembly.Property)
+ */
+ public void setProperty(Property property) {
+ checkNotFrozen();
+ this.property = property;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredProperty#getValue()
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredProperty#setValue(java.lang.Object)
+ */
+ public void setValue(Object value) {
+ checkNotFrozen();
+ this.value = value;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ if (property!=null)
+ property.initialize(modelContext);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ if (property!=null)
+ property.freeze();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (property!=null) {
+ if (!property.accept(visitor))
+ return false;
+ }
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,72 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Reference;
+
+/**
+ * An implementation of ConfiguredReference.
+ */
+public class ConfiguredReferenceImpl extends ConfiguredPortImpl implements ConfiguredReference {
+
+ private List<ConfiguredService> targetConfiguredServices = new ArrayList<ConfiguredService>();
+
+ /**
+ * Constructor
+ */
+ protected ConfiguredReferenceImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredReference#getReference()
+ */
+ public Reference getReference() {
+ return (Reference) super.getPort();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredReference#setReference(org.apache.tuscany.model.assembly.Reference)
+ */
+ public void setReference(Reference reference) {
+ checkNotFrozen();
+ super.setPort(reference);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredReference#getTargetConfiguredServices()
+ */
+ public List<ConfiguredService> getTargetConfiguredServices() {
+ return targetConfiguredServices;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.ConfiguredPortImpl#freeze()
+ */
+ public void freeze() {
+ super.freeze();
+
+ // Freeze list of configured services
+ targetConfiguredServices=Collections.unmodifiableList(targetConfiguredServices);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.Service;
+
+/**
+ * An implementation of ConfiguredService.
+ */
+public class ConfiguredServiceImpl extends ConfiguredPortImpl implements ConfiguredService {
+
+ /**
+ * Constructor
+ */
+ protected ConfiguredServiceImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredService#getService()
+ */
+ public Service getService() {
+ return (Service) super.getPort();
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.ConfiguredService#setService(org.apache.tuscany.model.assembly.Service)
+ */
+ public void setService(Service service) {
+ checkNotFrozen();
+ super.setPort(service);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,141 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+
+/**
+ * An implementation of EntryPoint.
+ */
+public class EntryPointImpl extends AggregatePartImpl implements EntryPoint {
+
+ private ConfiguredService configuredService;
+ private ConfiguredReference configuredReference;
+ private List<Binding> bindings=new ArrayList<Binding>();
+
+ /**
+ * Constructor
+ */
+ protected EntryPointImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.EntryPoint#getConfiguredReference()
+ */
+ public ConfiguredReference getConfiguredReference() {
+ return configuredReference;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.EntryPoint#setConfiguredReference(org.apache.tuscany.model.assembly.ConfiguredReference)
+ */
+ public void setConfiguredReference(ConfiguredReference configuredReference) {
+ checkNotFrozen();
+ this.configuredReference=configuredReference;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.EntryPoint#getConfiguredService()
+ */
+ public ConfiguredService getConfiguredService() {
+ return configuredService;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.EntryPoint#setConfiguredService(org.apache.tuscany.model.assembly.ConfiguredService)
+ */
+ public void setConfiguredService(ConfiguredService configuredService) {
+ checkNotFrozen();
+ this.configuredService=configuredService;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.EntryPoint#getBindings()
+ */
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize the service contract and reference to the published service
+ if (configuredReference != null)
+ configuredReference.initialize(modelContext);
+ if (configuredService != null)
+ configuredService.initialize(modelContext);
+
+ // Initialize the bindings
+ initialize(bindings, modelContext);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#freeze()
+ */
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze the service contract and configured reference
+ if (configuredReference != null)
+ configuredReference.freeze();
+ if (configuredService != null)
+ configuredService.freeze();
+
+ // Freeze the bindings
+ bindings=Collections.unmodifiableList(bindings);
+ freeze(bindings);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (configuredReference!=null) {
+ if (!configuredReference.accept(visitor))
+ return false;
+ }
+
+ if (configuredService!=null) {
+ if (!configuredService.accept(visitor))
+ return false;
+ }
+
+ if (!accept(bindings, visitor))
+ return false;
+
+ return true;
+ }
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java?rev=379376&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java (added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java Mon Feb 20 22:54:02 2006
@@ -0,0 +1,92 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelVisitor;
+import org.apache.tuscany.model.assembly.Extensible;
+
+/**
+ * An implementation of Extensible.
+ */
+public abstract class ExtensibleImpl extends AssemblyModelObjectImpl implements Extensible {
+
+ private List<Object> extensibilityElements=new ArrayList<Object>();
+ private List<Object> extensibilityAttributes=new ArrayList<Object>();
+
+ /**
+ * Constructor
+ */
+ protected ExtensibleImpl() {
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Extensible#getExtensibilityElements()
+ */
+ public List getExtensibilityElements() {
+ return extensibilityElements;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.Extensible#getExtensibilityAttributes()
+ */
+ public List getExtensibilityAttributes() {
+ return extensibilityAttributes;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.AssemblyModelObject#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Initialize extensibility elements and attributes
+ initialize(extensibilityElements, modelContext);
+ initialize(extensibilityAttributes, modelContext);
+ }
+
+ public void freeze() {
+ if (isFrozen())
+ return;
+ super.freeze();
+
+ // Freeze extensibility elements and attributes
+ freeze(extensibilityElements);
+ freeze(extensibilityAttributes);
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.AssemblyModelObjectImpl#accept(org.apache.tuscany.model.assembly.AssemblyModelVisitor)
+ */
+ public boolean accept(AssemblyModelVisitor visitor) {
+ if (!super.accept(visitor))
+ return false;
+
+ if (!accept(extensibilityElements, visitor))
+ return false;
+ if (!accept(extensibilityAttributes, visitor))
+ return false;
+
+ return true;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date