summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/modules/assembly/src/main/java
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-10-06 08:32:38 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-10-06 08:32:38 +0000
commit9fb2fb275d3f69a287ac4f1c7d55190fb7a7bb3b (patch)
tree40a3b6e43c677e8e9321921b95668eba4c75163a /branches/sca-equinox/modules/assembly/src/main/java
parent4f6fd64d654fec9afb231dd41af9c7d6e41d382f (diff)
Work in progress. Started to clean up cross-bundle dependencies on ContributionService implementation class, the various CompositeBuilder implementation classes and the ContributionDependencyBuilder implementation class. Added extension points for ContributionBuilders and CompositeBuilders to have them discovered and loaded by the Equinox ServiceDiscovery like other extension points. Moved injection of monitors and SCA definitions to the build methods instead of the constructors to remove references to these implementation constructors. Simplified NodeImpl a bit to remove references to other runtime implementation classes.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@702000 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/modules/assembly/src/main/java')
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java13
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java51
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java145
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java4
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java4
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java287
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java94
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java20
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java17
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java17
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java13
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java18
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java8
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java73
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java21
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java90
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java9
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java33
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java13
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java13
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java8
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java13
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java17
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java8
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java8
-rw-r--r--branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java17
26 files changed, 641 insertions, 373 deletions
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
index cf38894702..0d4f091b1e 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
@@ -20,6 +20,8 @@
package org.apache.tuscany.sca.assembly.builder;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.monitor.Monitor;
/**
* A builder that handles the configuration of the components inside a
@@ -28,13 +30,22 @@ import org.apache.tuscany.sca.assembly.Composite;
* @version $Rev$ $Date$
*/
public interface CompositeBuilder {
+
+ /**
+ * Returns the ID of the builder.
+ *
+ * @return
+ */
+ String getID();
/**
* Build a composite.
*
* @param composite
+ * @param definitions
+ * @param monitor
* @throws CompositeBuilderException
*/
- void build(Composite composite) throws CompositeBuilderException;
+ void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException;
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java
new file mode 100644
index 0000000000..a2d6b34db5
--- /dev/null
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sca.assembly.builder;
+
+/**
+ * An extension point for Composite builders.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public interface CompositeBuilderExtensionPoint {
+
+ /**
+ * Adds a composite builder.
+ *
+ * @param compositeBuilder
+ */
+ void addCompositeBuilder(CompositeBuilder compositeBuilder);
+
+ /**
+ * Removes a composite builder.
+ *
+ * @param compositeBuilder
+ */
+ void removeCompositeBuilder(CompositeBuilder compositeBuilder);
+
+ /**
+ * Returns the composite builder with the given id.
+ *
+ * @param id
+ * @return
+ */
+ CompositeBuilder getCompositeBuilder(String id);
+
+}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java
new file mode 100644
index 0000000000..46b6769e6e
--- /dev/null
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sca.assembly.builder;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultCompositeBuilderExtensionPoint implements CompositeBuilderExtensionPoint {
+
+ private ExtensionPointRegistry registry;
+ private final Map<String, CompositeBuilder> builders = new HashMap<String, CompositeBuilder>();
+ private boolean loaded;
+
+ public DefaultCompositeBuilderExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ public void addCompositeBuilder(CompositeBuilder builder) {
+ builders.put(builder.getID(), builder);
+ }
+
+ public void removeCompositeBuilder(CompositeBuilder builder) {
+ builders.remove(builder.getID());
+ }
+
+ public CompositeBuilder getCompositeBuilder(String id) {
+ loadBuilders();
+ return builders.get(id);
+ }
+
+ /**
+ * Load builders declared under META-INF/services.
+ */
+ private void loadBuilders() {
+ if (loaded)
+ return;
+
+ FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+
+ UtilityExtensionPoint utils = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ InterfaceContractMapper mapper = utils.getUtility(InterfaceContractMapper.class);
+
+ // Get the provider factory service declarations
+ Set<ServiceDeclaration> builderDeclarations;
+ ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance();
+ try {
+ builderDeclarations = serviceDiscovery.getServiceDeclarations(CompositeBuilder.class.getName());
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration builderDeclaration : builderDeclarations) {
+ Map<String, String> attributes = builderDeclaration.getAttributes();
+ String id = attributes.get("id");
+
+ CompositeBuilder builder = new LazyCompositeBuilder(id, builderDeclaration, this, factories, mapper);
+ builders.put(id, builder);
+ }
+ }
+
+ /**
+ * A wrapper around a composite builder allowing lazy
+ * loading and initialization of implementation providers.
+ */
+ private static class LazyCompositeBuilder implements CompositeBuilder {
+
+ private FactoryExtensionPoint factories;
+ private InterfaceContractMapper mapper;
+ private String id;
+ private ServiceDeclaration builderDeclaration;
+ private CompositeBuilder builder;
+ private CompositeBuilderExtensionPoint builders;
+
+ private LazyCompositeBuilder(String id, ServiceDeclaration factoryDeclaration,
+ CompositeBuilderExtensionPoint builders, FactoryExtensionPoint factories, InterfaceContractMapper mapper) {
+ this.id = id;
+ this.builderDeclaration = factoryDeclaration;
+ this.builders = builders;
+ this.factories = factories;
+ this.mapper = mapper;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ getBuilder().build(composite, definitions, monitor);
+ }
+
+ private CompositeBuilder getBuilder() {
+ if (builder == null) {
+ try {
+ Class<CompositeBuilder> builderClass = (Class<CompositeBuilder>)builderDeclaration.loadClass();
+ try {
+ Constructor<CompositeBuilder> constructor = builderClass.getConstructor(FactoryExtensionPoint.class, InterfaceContractMapper.class);
+ builder = constructor.newInstance(factories, mapper);
+ } catch (NoSuchMethodException e) {
+ Constructor<CompositeBuilder> constructor = builderClass.getConstructor(CompositeBuilderExtensionPoint.class, FactoryExtensionPoint.class, InterfaceContractMapper.class);
+ builder = constructor.newInstance(builders, factories, mapper);
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return builder;
+ }
+
+ }
+
+}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
index 9743117174..5d4055fc8e 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
@@ -28,7 +28,7 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class DefaultEndpointBuilder extends EndpointBuilderImpl {
- public DefaultEndpointBuilder (Monitor monitor){
- super(monitor);
+ public DefaultEndpointBuilder (){
+ super();
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java
index eb2977d87a..e98be49551 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java
@@ -20,6 +20,7 @@
package org.apache.tuscany.sca.assembly.builder;
import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.monitor.Monitor;
/**
* A builder that handles the configuration of reference endpoints
@@ -34,7 +35,8 @@ public interface EndpointBuilder {
* Build an endpoint.
*
* @param endpoint
+ * @param monitor
*/
- void build(Endpoint endpoint);
+ void build(Endpoint endpoint, Monitor monitor);
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
index cba46e7f5e..77d621c931 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
@@ -68,9 +68,7 @@ public abstract class BaseConfigurationBuilderImpl {
private AssemblyFactory assemblyFactory;
private SCABindingFactory scaBindingFactory;
- private Monitor monitor;
private InterfaceContractMapper interfaceContractMapper;
- private SCADefinitions policyDefinitions;
private DocumentBuilderFactory documentBuilderFactory;
private TransformerFactory transformerFactory;
@@ -78,28 +76,23 @@ public abstract class BaseConfigurationBuilderImpl {
SCABindingFactory scaBindingFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
this.assemblyFactory = assemblyFactory;
this.scaBindingFactory = scaBindingFactory;
this.documentBuilderFactory = documentBuilderFactory;
this.transformerFactory = transformerFactory;
this.interfaceContractMapper = interfaceContractMapper;
- this.policyDefinitions = policyDefinitions;
- this.monitor = monitor;
}
/**
* Configure components in the composite.
*
* @param composite
- * @param problems
+ * @param monitor
*/
- protected void configureComponents(Composite composite) throws CompositeBuilderException {
- configureComponents(composite, null);
+ protected void configureComponents(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ configureComponents(composite, null, monitor);
configureSourcedProperties(composite, null);
- //configureBindingURIs(composite, null, null);
}
/**
@@ -109,7 +102,7 @@ public abstract class BaseConfigurationBuilderImpl {
* @param uri
* @param problems
*/
- private void configureComponents(Composite composite, String uri) {
+ private void configureComponents(Composite composite, String uri, SCADefinitions definitions, Monitor monitor) {
String parentURI = uri;
// Process nested composites recursively
@@ -128,7 +121,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (implementation instanceof Composite) {
// Process nested composite
- configureComponents((Composite)implementation, componentURI);
+ configureComponents((Composite)implementation, componentURI, definitions, monitor);
}
}
@@ -139,52 +132,18 @@ public abstract class BaseConfigurationBuilderImpl {
// Create default SCA binding
if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
+ SCABinding scaBinding = createSCABinding(definitions);
service.getBindings().add(scaBinding);
}
-/*
- // Initialize binding names and URIs
- for (Binding binding : service.getBindings()) {
-
- // Binding name defaults to the service name
- if (binding.getName() == null) {
- binding.setName(service.getName());
- }
- }
-
- if (service.getCallback() != null) {
- for (Binding binding : service.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(service.getName());
- }
- }
- }
-*/
}
// Initialize reference bindings
for (Reference reference : composite.getReferences()) {
// Create default SCA binding
if (reference.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
+ SCABinding scaBinding = createSCABinding(definitions);
reference.getBindings().add(scaBinding);
}
-/*
- // Set binding names
- for (Binding binding : reference.getBindings()) {
- if (binding.getName() == null) {
- binding.setName(reference.getName());
- }
- }
-
- if (reference.getCallback() != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(reference.getName());
- }
- }
- }
-*/
}
// Initialize all component services and references
@@ -193,7 +152,7 @@ public abstract class BaseConfigurationBuilderImpl {
// Index all components and check for duplicates
if (components.containsKey(component.getName())) {
- error("DuplicateComponentName", component, composite.getName().toString(), component.getName());
+ error(monitor, "DuplicateComponentName", component, composite.getName().toString(), component.getName());
} else {
components.put(component.getName(), component);
}
@@ -214,28 +173,27 @@ public abstract class BaseConfigurationBuilderImpl {
indexImplementationPropertiesServicesAndReferences(component,
services,
references,
- properties);
+ properties,
+ monitor);
// Index component services, references and properties
// Also check for duplicates
- Map<String, ComponentService> componentServices =
- new HashMap<String, ComponentService>();
- Map<String, ComponentReference> componentReferences =
- new HashMap<String, ComponentReference>();
- Map<String, ComponentProperty> componentProperties =
- new HashMap<String, ComponentProperty>();
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+ Map<String, ComponentProperty> componentProperties = new HashMap<String, ComponentProperty>();
indexComponentPropertiesServicesAndReferences(component,
componentServices,
componentReferences,
- componentProperties);
+ componentProperties,
+ monitor);
// Reconcile component services/references/properties and
// implementation services/references and create component
// services/references/properties for the services/references
// declared by the implementation
- reconcileServices(component, services, componentServices);
- reconcileReferences(component, references, componentReferences);
- reconcileProperties(component, properties, componentProperties);
+ reconcileServices(component, services, componentServices, monitor);
+ reconcileReferences(component, references, componentReferences, monitor);
+ reconcileProperties(component, properties, componentProperties, monitor);
// Configure or create callback services for component's references
// with callbacks
@@ -245,36 +203,14 @@ public abstract class BaseConfigurationBuilderImpl {
// with callbacks
configureCallbackReferences(component, componentReferences);
- // Create self references to the component's services
-// if (!(component.getImplementation() instanceof Composite)) {
-// createSelfReferences(component);
-// }
-
// Initialize service bindings
for (ComponentService componentService : component.getServices()) {
// Create default SCA binding
if (componentService.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
+ SCABinding scaBinding = createSCABinding(definitions);
componentService.getBindings().add(scaBinding);
}
-/*
- // Set binding names
- for (Binding binding : componentService.getBindings()) {
-
- // Binding name defaults to the service name
- if (binding.getName() == null) {
- binding.setName(componentService.getName());
- }
- }
- if (componentService.getCallback() != null) {
- for (Binding binding : componentService.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(componentService.getName());
- }
- }
- }
-*/
}
// Initialize reference bindings
@@ -282,24 +218,9 @@ public abstract class BaseConfigurationBuilderImpl {
// Create default SCA binding
if (componentReference.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
+ SCABinding scaBinding = createSCABinding(definitions);
componentReference.getBindings().add(scaBinding);
}
-/*
- // Set binding names
- for (Binding binding : componentReference.getBindings()) {
- if (binding.getName() == null) {
- binding.setName(componentReference.getName());
- }
- }
- if (componentReference.getCallback() != null) {
- for (Binding binding : componentReference.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(componentReference.getName());
- }
- }
- }
-*/
}
}
}
@@ -307,11 +228,12 @@ public abstract class BaseConfigurationBuilderImpl {
/**
* Report a warning.
*
+ * @param monitor
* @param problems
* @param message
* @param model
*/
- private void warning(String message, Object model, String... messageParameters) {
+ private void warning(Monitor monitor, String message, Object model, String... messageParameters) {
if (monitor != null) {
Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
monitor.problem(problem);
@@ -321,11 +243,12 @@ public abstract class BaseConfigurationBuilderImpl {
/**
* Report a error.
*
+ * @param monitor
* @param problems
* @param message
* @param model
*/
- private void error(String message, Object model, String... messageParameters) {
+ private void error(Monitor monitor, String message, Object model, String... messageParameters) {
if (monitor != null) {
Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
monitor.problem(problem);
@@ -343,7 +266,8 @@ public abstract class BaseConfigurationBuilderImpl {
*/
private void reconcileProperties(Component component,
Map<String, Property> properties,
- Map<String, ComponentProperty> componentProperties) {
+ Map<String, ComponentProperty> componentProperties,
+ Monitor monitor) {
// Connect component properties to their properties
for (ComponentProperty componentProperty : component.getProperties()) {
@@ -351,7 +275,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (property != null) {
componentProperty.setProperty(property);
} else {
- warning("PropertyNotFound", component, component.getName(), componentProperty.getName());
+ warning(monitor, "PropertyNotFound", component, component.getName(), componentProperty.getName());
}
}
@@ -378,7 +302,7 @@ public abstract class BaseConfigurationBuilderImpl {
// Check that a component property does not override the
// mustSupply attribute
if (!property.isMustSupply() && componentProperty.isMustSupply()) {
- warning("PropertyMustSupplyIncompatible", component, component.getName(), componentProperty.getName());
+ warning(monitor, "PropertyMustSupplyIncompatible", component, component.getName(), componentProperty.getName());
}
// Default to the mustSupply attribute specified on the property
@@ -397,14 +321,14 @@ public abstract class BaseConfigurationBuilderImpl {
// Check that a value is supplied
if (componentProperty.getValue() == null && property.isMustSupply()) {
- warning("PropertyMustSupplyNull", component, component.getName(), componentProperty.getName());
+ warning(monitor, "PropertyMustSupplyNull", component, component.getName(), componentProperty.getName());
}
// Check that a a component property does not override the
// many attribute
if (!property.isMany() && componentProperty.isMany()) {
- warning("PropertyOverrideManyAttribute", component, component.getName(), componentProperty.getName());
+ warning(monitor, "PropertyOverrideManyAttribute", component, component.getName(), componentProperty.getName());
}
// Default to the many attribute defined on the property
@@ -420,7 +344,7 @@ public abstract class BaseConfigurationBuilderImpl {
// Check that a type or element are specified
if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
- warning("NoTypeForComponentProperty", component, component.getName(), componentProperty.getName());
+ warning(monitor, "NoTypeForComponentProperty", component, component.getName(), componentProperty.getName());
}
}
}
@@ -433,11 +357,12 @@ public abstract class BaseConfigurationBuilderImpl {
* @param component
* @param references
* @param componentReferences
- * @param problems
+ * @param monitor
*/
private void reconcileReferences(Component component,
Map<String, Reference> references,
- Map<String, ComponentReference> componentReferences) {
+ Map<String, ComponentReference> componentReferences,
+ Monitor monitor) {
// Connect each component reference to the corresponding reference
for (ComponentReference componentReference : component.getReferences()) {
@@ -449,7 +374,7 @@ public abstract class BaseConfigurationBuilderImpl {
componentReference.setReference(reference);
} else {
if (!componentReference.getName().startsWith("$self$.")) {
- error("ReferenceNotFound", component, component.getName(), componentReference.getName());
+ error(monitor, "ReferenceNotFound", component, component.getName(), componentReference.getName());
}
}
}
@@ -477,7 +402,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (!ReferenceConfigurationUtil.isValidMultiplicityOverride(reference.getMultiplicity(),
componentReference
.getMultiplicity())) {
- warning("ReferenceIncompatibleMultiplicity", component, component.getName(), componentReference.getName());
+ warning(monitor, "ReferenceIncompatibleMultiplicity", component, component.getName(), componentReference.getName());
}
} else {
componentReference.setMultiplicity(reference.getMultiplicity());
@@ -490,7 +415,7 @@ public abstract class BaseConfigurationBuilderImpl {
.getInterfaceContract())) {
if (!interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(),
interfaceContract)) {
- warning("ReferenceIncompatibleComponentInterface", component, component.getName(), componentReference.getName());
+ warning(monitor, "ReferenceIncompatibleComponentInterface", component, component.getName(), componentReference.getName());
}
}
} else {
@@ -535,11 +460,12 @@ public abstract class BaseConfigurationBuilderImpl {
* @param component
* @param services
* @param componentServices
- * @param problems
+ * @param monitor
*/
private void reconcileServices(Component component,
Map<String, Service> services,
- Map<String, ComponentService> componentServices) {
+ Map<String, ComponentService> componentServices,
+ Monitor monitor) {
// Connect each component service to the corresponding service
for (ComponentService componentService : component.getServices()) {
@@ -550,7 +476,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (service != null) {
componentService.setService(service);
} else {
- warning("ServiceNotFoundForComponentService", component, component.getName(), componentService.getName());
+ warning(monitor, "ServiceNotFoundForComponentService", component, component.getName(), componentService.getName());
}
}
@@ -579,7 +505,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (interfaceContract != null && !componentService.getInterfaceContract().equals(interfaceContract)) {
if (!interfaceContractMapper.isCompatible(componentService.getInterfaceContract(),
interfaceContract)) {
- warning("ServiceIncompatibleComponentInterface", component, component.getName(), componentService.getName());
+ warning(monitor, "ServiceIncompatibleComponentInterface", component, component.getName(), componentService.getName());
}
}
} else {
@@ -610,24 +536,25 @@ public abstract class BaseConfigurationBuilderImpl {
private void indexComponentPropertiesServicesAndReferences(Component component,
Map<String, ComponentService> componentServices,
Map<String, ComponentReference> componentReferences,
- Map<String, ComponentProperty> componentProperties) {
+ Map<String, ComponentProperty> componentProperties,
+ Monitor monitor) {
for (ComponentService componentService : component.getServices()) {
if (componentServices.containsKey(componentService.getName())) {
- warning("DuplicateComponentServiceName", component, component.getName(), componentService.getName());
+ warning(monitor, "DuplicateComponentServiceName", component, component.getName(), componentService.getName());
} else {
componentServices.put(componentService.getName(), componentService);
}
}
for (ComponentReference componentReference : component.getReferences()) {
if (componentReferences.containsKey(componentReference.getName())) {
- warning("DuplicateComponentReferenceName", component, component.getName(), componentReference.getName());
+ warning(monitor, "DuplicateComponentReferenceName", component, component.getName(), componentReference.getName());
} else {
componentReferences.put(componentReference.getName(), componentReference);
}
}
for (ComponentProperty componentProperty : component.getProperties()) {
if (componentProperties.containsKey(componentProperty.getName())) {
- warning("DuplicateComponentPropertyName", component, component.getName(), componentProperty.getName());
+ warning(monitor, "DuplicateComponentPropertyName", component, component.getName(), componentProperty.getName());
} else {
componentProperties.put(componentProperty.getName(), componentProperty);
}
@@ -638,17 +565,18 @@ public abstract class BaseConfigurationBuilderImpl {
private void indexImplementationPropertiesServicesAndReferences(Component component,
Map<String, Service> services,
Map<String, Reference> references,
- Map<String, Property> properties) {
+ Map<String, Property> properties,
+ Monitor monitor) {
// First check that the component has a resolved implementation
Implementation implementation = component.getImplementation();
if (implementation == null) {
// A component must have an implementation
- warning("NoComponentImplementation", component, component.getName());
+ warning(monitor, "NoComponentImplementation", component, component.getName());
} else if (implementation.isUnresolved()) {
// The implementation must be fully resolved
- warning("UnresolvedComponentImplementation", component, component.getName(), implementation.getURI());
+ warning(monitor, "UnresolvedComponentImplementation", component, component.getName(), implementation.getURI());
} else {
@@ -656,21 +584,21 @@ public abstract class BaseConfigurationBuilderImpl {
// duplicates
for (Property property : implementation.getProperties()) {
if (properties.containsKey(property.getName())) {
- warning("DuplicateImplementationPropertyName", component, component.getName(), property.getName());
+ warning(monitor, "DuplicateImplementationPropertyName", component, component.getName(), property.getName());
} else {
properties.put(property.getName(), property);
}
}
for (Service service : implementation.getServices()) {
if (services.containsKey(service.getName())) {
- warning("DuplicateImplementationServiceName", component, component.getName(), service.getName());
+ warning(monitor, "DuplicateImplementationServiceName", component, component.getName(), service.getName());
} else {
services.put(service.getName(), service);
}
}
for (Reference reference : implementation.getReferences()) {
if (references.containsKey(reference.getName())) {
- warning("DuplicateImplementationReferenceName", component, component.getName(), reference.getName());
+ warning(monitor, "DuplicateImplementationReferenceName", component, component.getName(), reference.getName());
} else {
references.put(reference.getName(), reference);
}
@@ -850,7 +778,7 @@ public abstract class BaseConfigurationBuilderImpl {
return null;
}
- private SCABinding createSCABinding() {
+ private SCABinding createSCABinding(SCADefinitions definitions) {
SCABinding scaBinding = scaBindingFactory.createSCABinding();
// mark the bindings that are added automatically so that they can
@@ -859,8 +787,8 @@ public abstract class BaseConfigurationBuilderImpl {
((AutomaticBinding)scaBinding).setIsAutomatic(true);
}
- if ( policyDefinitions != null ) {
- for ( IntentAttachPointType attachPointType : policyDefinitions.getBindingTypes() ) {
+ if ( definitions != null ) {
+ for ( IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
if ( attachPointType.getName().equals(BINDING_SCA_QNAME)) {
((IntentAttachPoint)scaBinding).setType(attachPointType);
}
@@ -875,9 +803,9 @@ public abstract class BaseConfigurationBuilderImpl {
*
* @param composite the composite to be configured
*/
- protected void configureBindingURIsAndNames(Composite composite) throws CompositeBuilderException {
- configureBindingURIs(composite, null, null);
- configureBindingNames(composite);
+ protected void configureBindingURIsAndNames(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ configureBindingURIs(composite, null, definitions, null, monitor);
+ configureBindingNames(composite, monitor);
}
/**
@@ -888,8 +816,10 @@ public abstract class BaseConfigurationBuilderImpl {
* @param composite the composite to be configured
* @param defaultBindings list of default binding configurations
*/
- protected void configureBindingURIs(Composite composite, List<Binding> defaultBindings) throws CompositeBuilderException {
- configureBindingURIs(composite, null, defaultBindings);
+ protected void configureBindingURIs(Composite composite,
+ SCADefinitions definitions, List<Binding> defaultBindings,
+ Monitor monitor) throws CompositeBuilderException {
+ configureBindingURIs(composite, null, definitions, defaultBindings, monitor);
}
/**
@@ -912,7 +842,9 @@ public abstract class BaseConfigurationBuilderImpl {
* @param uri the path to the composite provided through any nested composite component implementations
* @param defaultBindings list of default binding configurations
*/
- private void configureBindingURIs(Composite composite, String uri, List<Binding> defaultBindings) throws CompositeBuilderException {
+ private void configureBindingURIs(Composite composite, String uri,
+ SCADefinitions definitions, List<Binding> defaultBindings,
+ Monitor monitor) throws CompositeBuilderException {
String parentComponentURI = uri;
@@ -932,7 +864,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (implementation instanceof Composite) {
// Process nested composite
- configureBindingURIs((Composite)implementation, componentURI, defaultBindings);
+ configureBindingURIs((Composite)implementation, componentURI, definitions, defaultBindings, monitor);
}
}
@@ -943,14 +875,14 @@ public abstract class BaseConfigurationBuilderImpl {
// Create default SCA binding
if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
+ SCABinding scaBinding = createSCABinding(definitions);
service.getBindings().add(scaBinding);
}
// Initialize binding names and URIs
for (Binding binding : service.getBindings()) {
- constructBindingName(service, binding);
- constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings);
+ constructBindingName(service, binding, monitor);
+ constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings, monitor);
}
}
@@ -964,7 +896,8 @@ public abstract class BaseConfigurationBuilderImpl {
indexImplementationPropertiesServicesAndReferences(component,
services,
references,
- properties);
+ properties,
+ monitor);
// Index component services, references and properties
// Also check for duplicates
@@ -977,29 +910,30 @@ public abstract class BaseConfigurationBuilderImpl {
indexComponentPropertiesServicesAndReferences(component,
componentServices,
componentReferences,
- componentProperties);
+ componentProperties,
+ monitor);
// Reconcile component services/references/properties and
// implementation services/references and create component
// services/references/properties for the services/references
// declared by the implementation
- reconcileServices(component, services, componentServices);
- reconcileReferences(component, references, componentReferences);
- reconcileProperties(component, properties, componentProperties);
+ reconcileServices(component, services, componentServices, monitor);
+ reconcileReferences(component, references, componentReferences, monitor);
+ reconcileProperties(component, properties, componentProperties, monitor);
for (ComponentService service : component.getServices()) {
// Create default SCA binding
if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
+ SCABinding scaBinding = createSCABinding(definitions);
service.getBindings().add(scaBinding);
}
// Initialize binding names and URIs
for (Binding binding : service.getBindings()) {
- constructBindingName(service, binding);
- constructBindingURI(component, service, binding, defaultBindings);
+ constructBindingName(service, binding, monitor);
+ constructBindingURI(component, service, binding, defaultBindings, monitor);
}
}
}
@@ -1010,7 +944,7 @@ public abstract class BaseConfigurationBuilderImpl {
* separate from configureBindingURIs() because configureBindingURIs() is called
* by NodeConfigurationServiceImpl as well as by CompositeBuilderImpl.
*/
- private void configureBindingNames(Composite composite) {
+ private void configureBindingNames(Composite composite, Monitor monitor) {
// Process nested composites recursively
for (Component component : composite.getComponents()) {
@@ -1019,7 +953,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (implementation instanceof Composite) {
// Process nested composite
- configureBindingNames((Composite)implementation);
+ configureBindingNames((Composite)implementation, monitor);
}
}
@@ -1028,7 +962,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (service.getCallback() != null) {
for (Binding binding : service.getCallback().getBindings()) {
- constructBindingName(service, binding);
+ constructBindingName(service, binding, monitor);
}
}
}
@@ -1037,12 +971,12 @@ public abstract class BaseConfigurationBuilderImpl {
for (Reference reference : composite.getReferences()) {
for (Binding binding : reference.getBindings()) {
- constructBindingName(reference, binding);
+ constructBindingName(reference, binding, monitor);
}
if (reference.getCallback() != null) {
for (Binding binding : reference.getCallback().getBindings()) {
- constructBindingName(reference, binding);
+ constructBindingName(reference, binding, monitor);
}
}
}
@@ -1055,7 +989,7 @@ public abstract class BaseConfigurationBuilderImpl {
if (service.getCallback() != null) {
for (Binding binding : service.getCallback().getBindings()) {
- constructBindingName(service, binding);
+ constructBindingName(service, binding, monitor);
}
}
}
@@ -1065,12 +999,12 @@ public abstract class BaseConfigurationBuilderImpl {
// Initialize binding names
for (Binding binding : reference.getBindings()) {
- constructBindingName(reference, binding);
+ constructBindingName(reference, binding, monitor);
}
if (reference.getCallback() != null) {
for (Binding binding : reference.getCallback().getBindings()) {
- constructBindingName(reference, binding);
+ constructBindingName(reference, binding, monitor);
}
}
}
@@ -1084,7 +1018,7 @@ public abstract class BaseConfigurationBuilderImpl {
* @param contract the service or reference
* @param binding
*/
- private void constructBindingName(Contract contract, Binding binding) {
+ private void constructBindingName(Contract contract, Binding binding, Monitor monitor) {
// set the default binding name if one is required
// if there is no name on the binding then set it to the service or reference name
@@ -1103,7 +1037,7 @@ public abstract class BaseConfigurationBuilderImpl {
continue;
}
if (binding.getName().equals(otherBinding.getName())) {
- warning(contract instanceof Service ? "MultipleBindingsForService" : "MultipleBindingsForReference",
+ warning(monitor, contract instanceof Service ? "MultipleBindingsForService" : "MultipleBindingsForReference",
binding, contract.getName(), binding.getName());
}
}
@@ -1121,12 +1055,13 @@ public abstract class BaseConfigurationBuilderImpl {
* @param binding
* @param defaultBindings
*/
- private void constructBindingURI(String parentComponentURI, Composite composite, Service service, Binding binding, List<Binding> defaultBindings)
+ private void constructBindingURI(String parentComponentURI, Composite composite, Service service,
+ Binding binding, List<Binding> defaultBindings, Monitor monitor)
throws CompositeBuilderException{
// This is a composite service so there is no component to provide a component URI
// The path to this composite (through nested composites) is used.
boolean includeBindingName = composite.getServices().size() != 1;
- constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings);
+ constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings, monitor);
}
/**
@@ -1139,10 +1074,11 @@ public abstract class BaseConfigurationBuilderImpl {
* @param binding the binding for which the URI is being constructed
* @param defaultBindings the list of default binding configurations
*/
- private void constructBindingURI(Component component, Service service, Binding binding, List<Binding> defaultBindings)
+ private void constructBindingURI(Component component, Service service,
+ Binding binding, List<Binding> defaultBindings, Monitor monitor)
throws CompositeBuilderException{
boolean includeBindingName = component.getServices().size() != 1;
- constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings);
+ constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings, monitor);
}
/**
@@ -1155,7 +1091,8 @@ public abstract class BaseConfigurationBuilderImpl {
* @param defaultBindings the list of default binding configurations
* @throws CompositeBuilderException
*/
- private void constructBindingURI(String componentURIString, Service service, Binding binding, boolean includeBindingName, List<Binding> defaultBindings)
+ private void constructBindingURI(String componentURIString, Service service, Binding binding,
+ boolean includeBindingName, List<Binding> defaultBindings, Monitor monitor)
throws CompositeBuilderException{
try {
@@ -1196,28 +1133,6 @@ public abstract class BaseConfigurationBuilderImpl {
}
// calculate the base URI
-
- // get the protocol for this binding/URI
-/* some code that allows binding specific code to run. Being discussed on ML
- BindingURICalculator uriCalculator = bindingURICalcualtorExtensionPoint.getBindingURICalculator(binding);
-
- if (uriCalculator != null){
- String protocol = uriCalculator.getProtocol(binding);
-
- // find the default binding with the right protocol
- Binding defaultBinding = nodeInfo.getBindingDefault(binding, protocol);
-
- if (defaultBinding != null){
- baseURI = new URI(defaultBinding.getURI());
- } else {
- baseURI = null;
- }
-
- } else {
- baseURI = null;
- }
-*/
- // as a simpler alternative to the above commented out code.
URI baseURI = null;
if (defaultBindings != null) {
for (Binding defaultBinding : defaultBindings){
@@ -1230,7 +1145,7 @@ public abstract class BaseConfigurationBuilderImpl {
binding.setURI(constructBindingURI(baseURI, componentURI, bindingURI, includeBindingName, bindingName));
} catch (URISyntaxException ex) {
- error("URLSyntaxException", binding, componentURIString, service.getName(), binding.getName());
+ error(monitor, "URLSyntaxException", binding, componentURIString, service.getName(), binding.getName());
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
index b05ec7e24e..b026eb0811 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
@@ -58,19 +58,15 @@ import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
*/
class BaseWireBuilderImpl {
- private Monitor monitor;
- private AssemblyFactory assemblyFactory;
private EndpointFactory endpointFactory;
private InterfaceContractMapper interfaceContractMapper;
private EndpointBuilder endpointBuilder;
- protected BaseWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- this.assemblyFactory = assemblyFactory;
+ protected BaseWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper) {
this.endpointFactory = endpointFactory;
this.interfaceContractMapper = interfaceContractMapper;
- this.monitor = monitor;
- this.endpointBuilder = new DefaultEndpointBuilder(monitor);
+ this.endpointBuilder = new DefaultEndpointBuilder();
}
@@ -80,13 +76,13 @@ class BaseWireBuilderImpl {
*
* @param composite
*/
- protected void wireComponentReferences(Composite composite) {
+ protected void wireComponentReferences(Composite composite, Monitor monitor) {
// Wire nested composites recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- wireComponentReferences((Composite)implementation);
+ wireComponentReferences((Composite)implementation, monitor);
}
}
@@ -105,10 +101,10 @@ class BaseWireBuilderImpl {
//computePolicies(composite);
// Connect component references as described in wires
- connectWires(composite, componentServices, componentReferences);
+ connectWires(composite, componentServices, componentReferences, monitor);
// Connect component references to their targets
- connectComponentReferences(composite, components, componentServices, componentReferences);
+ connectComponentReferences(composite, components, componentServices, componentReferences, monitor);
// Validate that references are wired or promoted, according
// to their multiplicity
@@ -127,10 +123,10 @@ class BaseWireBuilderImpl {
}
}
if (!promoted && !componentReference.isCallback()) {
- warning("ReferenceWithoutTargets", composite, composite.getName().toString(), componentReference.getName());
+ warning(monitor, "ReferenceWithoutTargets", composite, composite.getName().toString(), componentReference.getName());
}
} else {
- warning("TooManyReferenceTargets", composite, componentReference.getName());
+ warning(monitor, "TooManyReferenceTargets", composite, componentReference.getName());
}
}
}
@@ -206,7 +202,7 @@ class BaseWireBuilderImpl {
* @param message
* @param model
*/
- private void warning(String message, Object model, String... messageParameters) {
+ private void warning(Monitor monitor, String message, Object model, String... messageParameters) {
if (monitor != null) {
Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
monitor.problem(problem);
@@ -220,7 +216,7 @@ class BaseWireBuilderImpl {
* @param message
* @param model
*/
- private void error(String message, Object model, Exception ex) {
+ private void error(Monitor monitor, String message, Object model, Exception ex) {
if (monitor != null) {
Problem problem = null;
problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex);
@@ -235,12 +231,12 @@ class BaseWireBuilderImpl {
* @param componentServices
* @param problems
*/
- protected void connectCompositeReferencesAndServices(Composite composite){
+ protected void connectCompositeReferencesAndServices(Composite composite, Monitor monitor){
// Wire nested composites recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- connectCompositeReferencesAndServices((Composite)implementation);
+ connectCompositeReferencesAndServices((Composite)implementation, monitor);
}
}
@@ -252,8 +248,8 @@ class BaseWireBuilderImpl {
// Connect composite services and references to the component
// services and references that they promote
- connectCompositeServices(composite, components, componentServices);
- connectCompositeReferences(composite, componentReferences);
+ connectCompositeServices(composite, components, componentServices, monitor);
+ connectCompositeReferences(composite, componentReferences, monitor);
}
/**
@@ -265,7 +261,8 @@ class BaseWireBuilderImpl {
*/
private void connectCompositeServices(Composite composite,
Map<String, Component> components,
- Map<String, ComponentService> componentServices) {
+ Map<String, ComponentService> componentServices,
+ Monitor monitor) {
// Propagate interfaces from inner composite components' services to
// their component services
@@ -316,12 +313,12 @@ class BaseWireBuilderImpl {
// Check the compositeServiceInterfaceContract and promotedServiceInterfaceContract
boolean isCompatible = interfaceContractMapper.isCompatible(compositeServiceInterfaceContract, promotedServiceInterfaceContract);
if(!isCompatible){
- warning("ServiceInterfaceNotSubSet", compositeService, promotedServiceName);
+ warning(monitor, "ServiceInterfaceNotSubSet", compositeService, promotedServiceName);
}
}
} else {
- warning("PromotedServiceNotFound", composite, composite.getName().toString(), promotedServiceName);
+ warning(monitor, "PromotedServiceNotFound", composite, composite.getName().toString(), promotedServiceName);
}
}
}
@@ -335,7 +332,8 @@ class BaseWireBuilderImpl {
* @param componentReferences
* @param problems
*/
- private void connectCompositeReferences(Composite composite, Map<String, ComponentReference> componentReferences) {
+ private void connectCompositeReferences(Composite composite,
+ Map<String, ComponentReference> componentReferences, Monitor monitor) {
// Propagate interfaces from inner composite components' references to
// their component references
@@ -379,11 +377,11 @@ class BaseWireBuilderImpl {
// Check the compositeInterfaceContract and componentInterfaceContract
boolean isCompatible = interfaceContractMapper.isCompatible(compositeReferenceInterfaceContract, componentReferenceInterfaceContract);
if (!isCompatible) {
- warning("ReferenceInterfaceNotSubSet", compositeReference, componentReferenceName);
+ warning(monitor, "ReferenceInterfaceNotSubSet", compositeReference, componentReferenceName);
}
}
} else {
- warning("PromotedReferenceNotFound", composite, composite.getName().toString(), componentReferenceName);
+ warning(monitor, "PromotedReferenceNotFound", composite, composite.getName().toString(), componentReferenceName);
}
}
}
@@ -393,7 +391,8 @@ class BaseWireBuilderImpl {
private List<Endpoint> createComponentReferenceTargets(Composite composite,
Map<String, Component> components,
Map<String, ComponentService> componentServices,
- ComponentReference componentReference) {
+ ComponentReference componentReference,
+ Monitor monitor) {
List<Endpoint> endpoints = new ArrayList<Endpoint>();
@@ -436,7 +435,7 @@ class BaseWireBuilderImpl {
if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
if (endpoints.size() == 0) {
- warning("NoComponentReferenceTarget", componentReference, componentReference.getName());
+ warning(monitor, "NoComponentReferenceTarget", componentReference, componentReference.getName());
}
}
@@ -446,7 +445,7 @@ class BaseWireBuilderImpl {
// binding elements with target endpoints specified via the target attribute
for (Binding binding : componentReference.getBindings()) {
if (binding.getURI() != null) {
- warning("ReferenceEndPointMixWithTarget", composite, componentReference.getName());
+ warning(monitor, "ReferenceEndPointMixWithTarget", composite, componentReference.getName());
}
}
@@ -485,7 +484,7 @@ class BaseWireBuilderImpl {
// see if an sca binding is associated with a resolved target or not
componentService.setUnresolved(false);
} else {
- warning("ReferenceIncompatibleInterface", composite, composite.getName().toString(),
+ warning(monitor, "ReferenceIncompatibleInterface", composite, composite.getName().toString(),
componentReference.getName(), componentService.getName());
}
} else {
@@ -503,7 +502,7 @@ class BaseWireBuilderImpl {
// The bindings will be cloned back into the reference when the
// target is finally resolved.
- warning("ComponentReferenceTargetNotFound", composite,
+ warning(monitor, "ComponentReferenceTargetNotFound", composite,
composite.getName().toString(), componentService.getName());
}
}
@@ -546,7 +545,7 @@ class BaseWireBuilderImpl {
// see if an sca binding is associated with a resolved target or not
componentService.setUnresolved(false);
} else {
- warning("ComponentIncompatibleInterface", composite,
+ warning(monitor, "ComponentIncompatibleInterface", composite,
componentReference.getName(), componentService.getName());
}
} else {
@@ -565,7 +564,7 @@ class BaseWireBuilderImpl {
endpoint.getCandidateBindings().addAll(componentReference.getBindings());
endpoints.add(endpoint);
- warning("ComponentReferenceTargetNotFound", composite,
+ warning(monitor, "ComponentReferenceTargetNotFound", composite,
composite.getName().toString(), componentService.getName());
}
}
@@ -633,7 +632,7 @@ class BaseWireBuilderImpl {
endpoint.getCandidateBindings().add(binding);
endpoints.add(endpoint);
} else {
- warning("ReferenceIncompatibleInterface",
+ warning(monitor, "ReferenceIncompatibleInterface",
composite,
composite.getName().toString(),
componentReference.getName(),
@@ -668,14 +667,16 @@ class BaseWireBuilderImpl {
private void connectComponentReferences(Composite composite,
Map<String, Component> components,
Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences){
+ Map<String, ComponentReference> componentReferences,
+ Monitor monitor){
for (ComponentReference componentReference : componentReferences.values()) {
List<Endpoint> endpoints = createComponentReferenceTargets(composite,
components,
componentServices,
- componentReference);
+ componentReference,
+ monitor);
componentReference.getEndpoints().addAll(endpoints);
@@ -691,7 +692,7 @@ class BaseWireBuilderImpl {
if (endpointsRequireAutomaticResolution) {
for(Endpoint endpoint : endpoints){
- endpointBuilder.build(endpoint);
+ endpointBuilder.build(endpoint, monitor);
}
// TODO - The following step ensures that the reference binding list remains
@@ -890,7 +891,8 @@ class BaseWireBuilderImpl {
*/
private void connectWires(Composite composite,
Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences) {
+ Map<String, ComponentReference> componentReferences,
+ Monitor monitor) {
// For each wire, resolve the source reference, the target service, and
// add it to the list of targets of the reference
@@ -908,7 +910,7 @@ class BaseWireBuilderImpl {
if (resolvedReference != null) {
wire.setSource(resolvedReference);
} else {
- warning("WireSourceNotFound", composite, source.getName());
+ warning(monitor, "WireSourceNotFound", composite, source.getName());
}
} else {
resolvedReference = wire.getSource();
@@ -921,7 +923,7 @@ class BaseWireBuilderImpl {
if (resolvedService != null) {
wire.setTarget(target);
} else {
- warning("WireTargetNotFound", composite, source.getName());
+ warning(monitor, "WireTargetNotFound", composite, source.getName());
}
} else {
resolvedService = wire.getTarget();
@@ -939,7 +941,7 @@ class BaseWireBuilderImpl {
//resolvedReference.getTargets().add(resolvedService);
resolvedReference.getTargets().add(wire.getTarget());
} else {
- warning("WireIncompatibleInterface", composite, source.getName(), target.getName());
+ warning(monitor, "WireIncompatibleInterface", composite, source.getName(), target.getName());
}
}
}
@@ -969,13 +971,13 @@ class BaseWireBuilderImpl {
}
- protected void computePolicies(Composite composite) {
+ protected void computePolicies(Composite composite, Monitor monitor) {
// compute policies recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- computePolicies((Composite)implementation);
+ computePolicies((Composite)implementation, monitor);
}
}
@@ -992,7 +994,7 @@ class BaseWireBuilderImpl {
try {
PolicyConfigurationUtil.computeImplementationIntentsAndPolicySets(implemenation, component);
} catch ( Exception e ) {
- error("PolicyRelatedException", implemenation, e);
+ error(monitor, "PolicyRelatedException", implemenation, e);
//throw new RuntimeException(e);
}
@@ -1032,7 +1034,7 @@ class BaseWireBuilderImpl {
PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentService, null);
} catch ( Exception e ) {
- error("PolicyRelatedException", componentService, e);
+ error(monitor, "PolicyRelatedException", componentService, e);
//throw new RuntimeException(e);
}
}
@@ -1063,7 +1065,7 @@ class BaseWireBuilderImpl {
false);
}
} catch ( Exception e ) {
- error("PolicyRelatedException", componentReference, e);
+ error(monitor, "PolicyRelatedException", componentReference, e);
//throw new RuntimeException(e);
}
}
@@ -1083,7 +1085,7 @@ class BaseWireBuilderImpl {
PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(service);
PolicyConfigurationUtil.determineApplicableBindingPolicySets(service, null);
} catch ( Exception e ) {
- error("PolicyRelatedException", service, e);
+ error(monitor, "PolicyRelatedException", service, e);
//throw new RuntimeException(e);
}
@@ -1108,7 +1110,7 @@ class BaseWireBuilderImpl {
PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(reference);
PolicyConfigurationUtil.determineApplicableBindingPolicySets(reference, null);
} catch ( Exception e ) {
- error("PolicyRelatedException", reference, e);
+ error(monitor, "PolicyRelatedException", reference, e);
//throw new RuntimeException(e);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
index 0643421a45..cbd53187c4 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
@@ -41,28 +41,28 @@ public class ComponentConfigurationBuilderImpl extends BaseConfigurationBuilderI
@Deprecated
public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
super(assemblyFactory, scaBindingFactory,
null, null,
- interfaceContractMapper, policyDefinitions, monitor);
+ interfaceContractMapper);
}
public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
super(assemblyFactory, scaBindingFactory,
documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions, monitor);
+ interfaceContractMapper);
+ }
+
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentConfigurationBuilder";
}
- public void build(Composite composite) throws CompositeBuilderException {
- configureComponents(composite);
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ configureComponents(composite, definitions, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
index 4913705e91..d289bd3749 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
@@ -27,6 +27,7 @@ import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -36,17 +37,19 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder {
- private Monitor monitor;
- public ComponentReferenceBindingBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
+ public ComponentReferenceBindingBuilderImpl() {
}
- public void build(Composite composite) throws CompositeBuilderException {
- buildReferenceBindings(composite);
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ buildReferenceBindings(composite, monitor);
}
- private void buildReferenceBindings(Composite composite) {
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceBindingBuilder";
+ }
+
+ private void buildReferenceBindings(Composite composite, Monitor monitor) {
// find all the component reference bindings (starting at top level)
for (Component component : composite.getComponents()) {
@@ -63,7 +66,7 @@ public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder {
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- buildReferenceBindings((Composite)implementation);
+ buildReferenceBindings((Composite)implementation, monitor);
}
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
index c0702c87b3..61921a4df9 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
@@ -35,6 +35,7 @@ import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -45,16 +46,18 @@ import org.apache.tuscany.sca.monitor.Monitor;
public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuilder {
private AssemblyFactory assemblyFactory;
private EndpointFactory endpointFactory;
- private Monitor monitor;
- public ComponentReferencePromotionWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, Monitor monitor) {
+ public ComponentReferencePromotionWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory) {
this.assemblyFactory = assemblyFactory;
this.endpointFactory = endpointFactory;
- this.monitor = monitor;
}
- public void build(Composite composite) throws CompositeBuilderException {
- wireCompositeReferences(composite);
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ wireCompositeReferences(composite, monitor);
+ }
+
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentReferencePromotionWireBuilder";
}
/**
@@ -63,13 +66,13 @@ public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuil
* @param composite
* @param problems
*/
- private void wireCompositeReferences(Composite composite) {
+ private void wireCompositeReferences(Composite composite, Monitor monitor) {
// Process nested composites recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- wireCompositeReferences((Composite)implementation);
+ wireCompositeReferences((Composite)implementation, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
index 927330b139..9fe08f9730 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
@@ -24,6 +24,7 @@ import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.EndpointFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -34,11 +35,15 @@ import org.apache.tuscany.sca.monitor.Monitor;
*/
public class ComponentReferenceWireBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
- public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper);
}
- public void build(Composite composite) throws CompositeBuilderException {
- wireComponentReferences(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceWireBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ wireComponentReferences(composite, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
index 12ea86eac3..a98522b2bf 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
@@ -24,11 +24,11 @@ import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -38,23 +38,25 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class ComponentServiceBindingBuilderImpl implements CompositeBuilder {
- private Monitor monitor;
- public ComponentServiceBindingBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
+ public ComponentServiceBindingBuilderImpl() {
}
- public void build(Composite composite) throws CompositeBuilderException {
- buildServiceBindings(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentServiceBindingBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ buildServiceBindings(composite, monitor);
}
- private void buildServiceBindings(Composite composite) {
+ private void buildServiceBindings(Composite composite, Monitor monitor) {
// build bindings recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- buildServiceBindings((Composite)implementation);
+ buildServiceBindings((Composite)implementation, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
index d73286f7ab..282de1fbde 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
@@ -28,6 +28,8 @@ import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.monitor.Monitor;
/**
* A composite builder that handles the creation of promoted services.
@@ -41,7 +43,11 @@ public class ComponentServicePromotionBuilderImpl implements CompositeBuilder {
this.assemblyFactory = assemblyFactory;
}
- public void build(Composite composite) throws CompositeBuilderException {
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentServicePromotionBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
// Process nested composites recursively
configureNestedCompositeServices(composite);
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..9f618ecb51
--- /dev/null
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sca.assembly.builder.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that performs any additional building steps that
+ * composite service bindings may need. Used for WSDL generation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBindingConfigurationBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
+
+ public CompositeBindingConfigurationBuilderImpl(FactoryExtensionPoint factories, InterfaceContractMapper mapper) {
+ super(factories.getFactory(AssemblyFactory.class),
+ factories.getFactory(SCABindingFactory.class),
+ null, null,
+ mapper);
+ }
+
+ public CompositeBindingConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper) {
+ super(assemblyFactory,
+ scaBindingFactory,
+ null, null,
+ interfaceContractMapper);
+ }
+
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeServiceBindingBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ List<Binding> defaultBindings = null;
+ for (Object x: composite.getExtensions()) {
+ if (x instanceof List) {
+ defaultBindings = (List<Binding>)x;
+ }
+ }
+ configureBindingURIs(composite, definitions, defaultBindings, monitor);
+ }
+
+}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
index 85af173c0d..030eb76eae 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
@@ -41,28 +41,27 @@ public class CompositeBindingURIBuilderImpl extends BaseConfigurationBuilderImpl
@Deprecated
public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
super(assemblyFactory, scaBindingFactory,
null, null,
- interfaceContractMapper, policyDefinitions, monitor);
+ interfaceContractMapper);
}
public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
super(assemblyFactory, scaBindingFactory,
- documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions, monitor);
+ documentBuilderFactory, transformerFactory, interfaceContractMapper);
}
- public void build(Composite composite) throws CompositeBuilderException {
- configureBindingURIsAndNames(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeBindingURIBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ configureBindingURIsAndNames(composite, definitions, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
index 282fe032ba..2225e81e4b 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
@@ -30,7 +30,7 @@ import org.apache.tuscany.sca.assembly.EndpointFactory;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -60,6 +60,16 @@ public class CompositeBuilderImpl implements CompositeBuilder {
private CompositeBuilder componentServiceBindingBuilder;
private CompositeBuilder componentReferenceBindingBuilder;
+ public CompositeBuilderImpl(FactoryExtensionPoint factories, InterfaceContractMapper mapper) {
+ this(factories.getFactory(AssemblyFactory.class),
+ factories.getFactory(EndpointFactory.class),
+ factories.getFactory(SCABindingFactory.class),
+ factories.getFactory(IntentAttachPointTypeFactory.class),
+ factories.getFactory(DocumentBuilderFactory.class),
+ factories.getFactory(TransformerFactory.class),
+ mapper);
+ }
+
/**
* Constructs a new composite builder.
*
@@ -76,11 +86,9 @@ public class CompositeBuilderImpl implements CompositeBuilder {
EndpointFactory endpointFactory,
SCABindingFactory scaBindingFactory,
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
- null, null, interfaceContractMapper, policyDefinitions, monitor);
+ null, null, interfaceContractMapper);
}
/**
@@ -98,10 +106,9 @@ public class CompositeBuilderImpl implements CompositeBuilder {
public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- null, null, interfaceContractMapper, null, monitor);
+ null, null, interfaceContractMapper);
}
/**
@@ -120,10 +127,9 @@ public class CompositeBuilderImpl implements CompositeBuilder {
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor);
+ documentBuilderFactory, transformerFactory, interfaceContractMapper);
}
/**
@@ -143,77 +149,79 @@ public class CompositeBuilderImpl implements CompositeBuilder {
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
+ InterfaceContractMapper interfaceContractMapper) {
if (endpointFactory == null){
endpointFactory = new DefaultEndpointFactory();
}
- compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
- componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
- componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
- compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
- compositeCloneBuilder = new CompositeCloneBuilderImpl(monitor);
- componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeIncludeBuilder = new CompositeIncludeBuilderImpl();
+ componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper);
+ componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory);
+ compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory);
+ compositeCloneBuilder = new CompositeCloneBuilderImpl();
+ componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper);
compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory);
compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
- compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper);
componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
- compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
- compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
- componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(monitor);
- componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(monitor);
+ compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper);
+ compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper);
+ componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl();
+ componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl();
+ }
+
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeBuilder";
}
- public void build(Composite composite) throws CompositeBuilderException {
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
// Collect and fuse includes
- compositeIncludeBuilder.build(composite);
+ compositeIncludeBuilder.build(composite, definitions, monitor);
// Expand nested composites
- compositeCloneBuilder.build(composite);
+ compositeCloneBuilder.build(composite, definitions, monitor);
// Configure all components
- componentConfigurationBuilder.build(composite);
+ componentConfigurationBuilder.build(composite, definitions, monitor);
// Connect composite services/references to promoted services/references
- compositePromotionBuilder.build(composite);
+ compositePromotionBuilder.build(composite, definitions, monitor);
// Compute the policies across the model hierarchy
- compositePolicyBuilder.build(composite);
+ compositePolicyBuilder.build(composite, definitions, monitor);
// Configure composite services
- compositeServiceConfigurationBuilder.build(composite);
+ compositeServiceConfigurationBuilder.build(composite, definitions, monitor);
// Configure composite references
- compositeReferenceConfigurationBuilder.build(composite);
+ compositeReferenceConfigurationBuilder.build(composite, definitions, monitor);
// Configure binding URIs
- compositeBindingURIBuilder.build(composite);
+ compositeBindingURIBuilder.build(composite, definitions, monitor);
// Create promoted component services
- componentServicePromotionBuilder.build(composite);
+ componentServicePromotionBuilder.build(composite, definitions, monitor);
// Create promoted composite services
- compositeServicePromotionBuilder.build(composite);
+ compositeServicePromotionBuilder.build(composite, definitions, monitor);
// Build component service binding-related information
- componentServiceBindingBuilder.build(composite);
+ componentServiceBindingBuilder.build(composite, definitions, monitor);
// Wire the components
- componentReferenceWireBuilder.build(composite);
+ componentReferenceWireBuilder.build(composite, definitions, monitor);
// Wire the promoted component references
- componentReferencePromotionWireBuilder.build(composite);
+ componentReferencePromotionWireBuilder.build(composite, definitions, monitor);
// Wire the composite references
- compositeReferenceWireBuilder.build(composite);
+ compositeReferenceWireBuilder.build(composite, definitions, monitor);
// Build component reference binding-related information
- componentReferenceBindingBuilder.build(composite);
+ componentReferenceBindingBuilder.build(composite, definitions, monitor);
// Fuse nested composites
//FIXME do this later
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
index 5779ddbc78..d5c6b63454 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
@@ -28,6 +28,7 @@ import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -37,13 +38,17 @@ import org.apache.tuscany.sca.monitor.Monitor;
*/
public class CompositeCloneBuilderImpl implements CompositeBuilder {
- public CompositeCloneBuilderImpl(Monitor monitor) {
+ public CompositeCloneBuilderImpl() {
}
- public void build(Composite composite) throws CompositeBuilderException {
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
expandCompositeImplementations(composite);
}
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeCloneBuilder";
+ }
+
/**
* Expand composite component implementations.
*
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
index 5f507ece1f..7980664493 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
@@ -27,6 +27,9 @@ import java.util.Set;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
@@ -37,18 +40,22 @@ import org.apache.tuscany.sca.monitor.Problem.Severity;
* @version $Rev$ $Date$
*/
public class CompositeIncludeBuilderImpl implements CompositeBuilder {
-
- private Monitor monitor;
- public CompositeIncludeBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
+ public CompositeIncludeBuilderImpl(FactoryExtensionPoint factories, InterfaceContractMapper mapper) {
+ }
+
+ public CompositeIncludeBuilderImpl() {
}
- public void build(Composite composite) throws CompositeBuilderException {
- fuseIncludes(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeIncludeBuilder";
}
- private void warning(String message, Object model, String... messageParameters) {
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ fuseIncludes(composite, monitor);
+ }
+
+ private void warning(Monitor monitor, String message, Object model, String... messageParameters) {
if (monitor != null){
Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
monitor.problem(problem);
@@ -61,16 +68,17 @@ public class CompositeIncludeBuilderImpl implements CompositeBuilder {
* @param composite
* @param includes
*/
- private void collectIncludes(Composite composite, List<Composite> includes, Set<Composite> visited) {
+ private void collectIncludes(Composite composite, List<Composite> includes,
+ Set<Composite> visited, Monitor monitor) {
for (Composite include : composite.getIncludes()) {
if (visited.contains(include)) {
- warning("CompositeAlreadyIncluded", composite, include.getName().toString());
+ warning(monitor, "CompositeAlreadyIncluded", composite, include.getName().toString());
continue;
}
includes.add(include);
visited.add(include);
- collectIncludes(include, includes, visited);
+ collectIncludes(include, includes, visited, monitor);
}
}
@@ -79,13 +87,14 @@ public class CompositeIncludeBuilderImpl implements CompositeBuilder {
*
* @param composite
*/
- private void fuseIncludes(Composite composite) {
+ private void fuseIncludes(Composite composite, Monitor monitor) {
// First collect all includes
List<Composite> includes = new ArrayList<Composite>();
Set<Composite> visited = new HashSet<Composite>();
visited.add(composite);
- collectIncludes(composite, includes, visited);
+ collectIncludes(composite, includes, visited, monitor);
+
// Then clone them
for (Composite include : includes) {
Composite clone;
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
index 76ed861167..ce3c028933 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
@@ -25,6 +25,7 @@ import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.EndpointFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -37,11 +38,15 @@ import org.apache.tuscany.sca.monitor.Monitor;
*/
public class CompositePolicyBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
- public CompositePolicyBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ public CompositePolicyBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper);
}
- public void build(Composite composite) throws CompositeBuilderException {
- computePolicies(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositePolicyBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ computePolicies(composite, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
index 5a6437b3a3..3f786377a9 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
@@ -25,6 +25,7 @@ import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.EndpointFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -36,11 +37,15 @@ import org.apache.tuscany.sca.monitor.Monitor;
*/
public class CompositePromotionBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
- public CompositePromotionBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ public CompositePromotionBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper);
}
- public void build(Composite composite) throws CompositeBuilderException {
- connectCompositeReferencesAndServices(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositePromotionBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ connectCompositeReferencesAndServices(composite, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
index 41462b151d..09c57b617f 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
@@ -31,6 +31,8 @@ import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.monitor.Monitor;
/**
* A composite builder that handles the configuration of composite references.
@@ -44,7 +46,11 @@ public class CompositeReferenceConfigurationBuilderImpl implements CompositeBuil
this.assemblyFactory = assemblyFactory;
}
- public void build(Composite composite) throws CompositeBuilderException {
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeReferenceConfigurationBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
// Process nested composites recursively
configureNestedCompositeReferences(composite);
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
index 8aa1897311..7d59964efa 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
@@ -22,16 +22,15 @@ package org.apache.tuscany.sca.assembly.builder.impl;
import java.util.List;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.CompositeReference;
import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -42,12 +41,14 @@ import org.apache.tuscany.sca.monitor.Monitor;
public class CompositeReferenceWireBuilderImpl implements CompositeBuilder {
private AssemblyFactory assemblyFactory;
private EndpointFactory endpointFactory;
- private Monitor monitor;
- public CompositeReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, Monitor monitor) {
+ public CompositeReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory) {
this.assemblyFactory = assemblyFactory;
this.endpointFactory = endpointFactory;
- this.monitor = monitor;
+ }
+
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceWireBuilder";
}
/**
@@ -55,7 +56,7 @@ public class CompositeReferenceWireBuilderImpl implements CompositeBuilder {
*
* @param composite
*/
- public void build(Composite composite) throws CompositeBuilderException {
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
// Process composite references declared in this composite
for (Reference reference : composite.getReferences()) {
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
index 3aa9f3bf85..e0d3a91809 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
@@ -28,6 +28,7 @@ import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -37,23 +38,25 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class CompositeServiceBindingBuilderImpl implements CompositeBuilder {
- private Monitor monitor;
- public CompositeServiceBindingBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
+ public CompositeServiceBindingBuilderImpl() {
}
- public void build(Composite composite) throws CompositeBuilderException {
- buildServiceBindings(composite);
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeServiceBindingBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
+ buildServiceBindings(composite, monitor);
}
- private void buildServiceBindings(Composite composite) {
+ private void buildServiceBindings(Composite composite, Monitor monitor) {
// build bindings recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- buildServiceBindings((Composite)implementation);
+ buildServiceBindings((Composite)implementation, monitor);
}
}
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
index a3f31ea2fa..c5f109c473 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
@@ -31,6 +31,8 @@ import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.monitor.Monitor;
/**
* A composite builder that handles the configuration of composite services.
@@ -44,7 +46,11 @@ public class CompositeServiceConfigurationBuilderImpl implements CompositeBuilde
this.assemblyFactory = assemblyFactory;
}
- public void build(Composite composite) throws CompositeBuilderException {
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeServiceConfigurationBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
// Process nested composites recursively
configureNestedCompositeServices(composite);
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
index ea0e88ac24..07efb399c3 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
@@ -27,6 +27,8 @@ import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.monitor.Monitor;
/**
* A composite builder that handles the creation of promoted composite services.
@@ -40,7 +42,11 @@ public class CompositeServicePromotionBuilderImpl implements CompositeBuilder {
this.assemblyFactory = assemblyFactory;
}
- public void build(Composite composite) throws CompositeBuilderException {
+ public String getID() {
+ return "org.apache.tuscany.sca.assembly.builder.CompositeServicePromotionBuilder";
+ }
+
+ public void build(Composite composite, SCADefinitions definitions, Monitor monitor) throws CompositeBuilderException {
// Process top level composite services
for (Service service : composite.getServices()) {
diff --git a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
index ce9a64c8d8..52e64c5067 100644
--- a/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
+++ b/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
@@ -35,20 +35,17 @@ import org.apache.tuscany.sca.monitor.Problem.Severity;
*/
public abstract class EndpointBuilderImpl implements EndpointBuilder {
- private Monitor monitor;
-
- public EndpointBuilderImpl (Monitor monitor){
- this.monitor = monitor;
+ public EndpointBuilderImpl (){
}
- private void warning(String message, Object model, String... messageParameters) {
+ private void warning(Monitor monitor, String message, Object model, String... messageParameters) {
if (monitor != null){
Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
monitor.problem(problem);
}
}
- private void error(String message, Object model, Exception ex) {
+ private void error(Monitor monitor, String message, Object model, Exception ex) {
if (monitor != null){
Problem problem = null;
problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex);
@@ -60,7 +57,7 @@ public abstract class EndpointBuilderImpl implements EndpointBuilder {
* Resolve an endpoint against the provided target information and the
* set of candidate bindings.
*/
- public void build(Endpoint endpoint) {
+ public void build(Endpoint endpoint, Monitor monitor) {
// If this endpoint is not fully configured then don't try and resolve it
if (endpoint.getTargetComponentService() == null){
@@ -90,7 +87,7 @@ public abstract class EndpointBuilderImpl implements EndpointBuilder {
PolicyConfigurationUtil.determineApplicableBindingPolicySets(endpoint.getSourceComponentReference(),
endpoint.getTargetComponentService());
} catch ( Exception e ) {
- error("PolicyRelatedException", endpoint, e);
+ error(monitor, "PolicyRelatedException", endpoint, e);
}
@@ -100,7 +97,7 @@ public abstract class EndpointBuilderImpl implements EndpointBuilder {
endpoint.getCandidateBindings(),
endpoint.getTargetComponentService().getBindings());
if (resolvedBinding == null) {
- warning("NoMatchingBinding",
+ warning(monitor, "NoMatchingBinding",
endpoint.getSourceComponentReference(),
endpoint.getSourceComponentReference().getName(),
endpoint.getTargetComponentService().getName());
@@ -114,7 +111,7 @@ public abstract class EndpointBuilderImpl implements EndpointBuilder {
endpoint.getSourceComponentReference().getCallback().getBindings(),
endpoint.getTargetComponentService().getCallback().getBindings());
if (resolvedBinding == null) {
- warning("NoMatchingCallbackBinding",
+ warning(monitor, "NoMatchingCallbackBinding",
endpoint.getSourceComponentReference(),
endpoint.getSourceComponentReference().getName(),
endpoint.getTargetComponentService().getName());