You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2008/10/06 10:33:10 UTC
svn commit: r702000 [2/8] - in /tuscany/branches/sca-equinox:
demos/bigbank-account/src/main/java/bigbank/account/security/
itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/
itest/policy/src/test/java/org/apache/tuscany/sca/itest/ itest...
Modified: tuscany/branches/sca-equinox/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java Mon Oct 6 01:32:38 2008
@@ -33,11 +33,11 @@
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
/**
* Test writing SCA XML assemblies.
@@ -52,7 +52,7 @@
@Override
public void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
//outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
inputFactory = modelFactories.getFactory(XMLInputFactory.class);
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java Mon Oct 6 01:32:38 2008
@@ -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 @@
* @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;
}
Copied: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java (from r701972, tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java)
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java?p2=tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java&p1=tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java&r1=701972&r2=702000&rev=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderExtensionPoint.java Mon Oct 6 01:32:38 2008
@@ -19,22 +19,33 @@
package org.apache.tuscany.sca.assembly.builder;
-import org.apache.tuscany.sca.assembly.Composite;
-
/**
- * A builder that handles the configuration of the components inside a
- * composite and the wiring of component references to component services.
+ * An extension point for Composite builders.
*
- * @version $Rev$ $Date$
+ * @version $Rev: $ $Date: $
*/
-public interface CompositeBuilder {
+public interface CompositeBuilderExtensionPoint {
+
+ /**
+ * Adds a composite builder.
+ *
+ * @param compositeBuilder
+ */
+ void addCompositeBuilder(CompositeBuilder compositeBuilder);
+
+ /**
+ * Removes a composite builder.
+ *
+ * @param compositeBuilder
+ */
+ void removeCompositeBuilder(CompositeBuilder compositeBuilder);
/**
- * Build a composite.
+ * Returns the composite builder with the given id.
*
- * @param composite
- * @throws CompositeBuilderException
+ * @param id
+ * @return
*/
- void build(Composite composite) throws CompositeBuilderException;
+ CompositeBuilder getCompositeBuilder(String id);
}
Added: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java?rev=702000&view=auto
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java (added)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java Mon Oct 6 01:32:38 2008
@@ -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;
+ }
+
+ }
+
+}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java Mon Oct 6 01:32:38 2008
@@ -28,7 +28,7 @@
* @version $Rev$ $Date$
*/
public class DefaultEndpointBuilder extends EndpointBuilderImpl {
- public DefaultEndpointBuilder (Monitor monitor){
- super(monitor);
+ public DefaultEndpointBuilder (){
+ super();
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java Mon Oct 6 01:32:38 2008
@@ -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 @@
* Build an endpoint.
*
* @param endpoint
+ * @param monitor
*/
- void build(Endpoint endpoint);
+ void build(Endpoint endpoint, Monitor monitor);
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -68,9 +68,7 @@
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 @@
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 @@
* @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 @@
if (implementation instanceof Composite) {
// Process nested composite
- configureComponents((Composite)implementation, componentURI);
+ configureComponents((Composite)implementation, componentURI, definitions, monitor);
}
}
@@ -139,52 +132,18 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
/**
* 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 @@
/**
* 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 @@
*/
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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
* @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 @@
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 @@
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 @@
.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 @@
* @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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
((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 @@
*
* @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 @@
* @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 @@
* @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 @@
if (implementation instanceof Composite) {
// Process nested composite
- configureBindingURIs((Composite)implementation, componentURI, defaultBindings);
+ configureBindingURIs((Composite)implementation, componentURI, definitions, defaultBindings, monitor);
}
}
@@ -943,14 +875,14 @@
// 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 @@
indexImplementationPropertiesServicesAndReferences(component,
services,
references,
- properties);
+ properties,
+ monitor);
// Index component services, references and properties
// Also check for duplicates
@@ -977,29 +910,30 @@
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 @@
* 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 @@
if (implementation instanceof Composite) {
// Process nested composite
- configureBindingNames((Composite)implementation);
+ configureBindingNames((Composite)implementation, monitor);
}
}
@@ -1028,7 +962,7 @@
if (service.getCallback() != null) {
for (Binding binding : service.getCallback().getBindings()) {
- constructBindingName(service, binding);
+ constructBindingName(service, binding, monitor);
}
}
}
@@ -1037,12 +971,12 @@
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 @@
if (service.getCallback() != null) {
for (Binding binding : service.getCallback().getBindings()) {
- constructBindingName(service, binding);
+ constructBindingName(service, binding, monitor);
}
}
}
@@ -1065,12 +999,12 @@
// 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 @@
* @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 @@
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 @@
* @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 @@
* @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 @@
* @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 @@
}
// 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 @@
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());
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -58,19 +58,15 @@
*/
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 @@
*
* @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 @@
//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 @@
}
}
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 @@
* @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 @@
* @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 @@
* @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 @@
// 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 @@
*/
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 @@
// 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 @@
* @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 @@
// 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 @@
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 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
endpoint.getCandidateBindings().addAll(componentReference.getBindings());
endpoints.add(endpoint);
- warning("ComponentReferenceTargetNotFound", composite,
+ warning(monitor, "ComponentReferenceTargetNotFound", composite,
composite.getName().toString(), componentService.getName());
}
}
@@ -633,7 +632,7 @@
endpoint.getCandidateBindings().add(binding);
endpoints.add(endpoint);
} else {
- warning("ReferenceIncompatibleInterface",
+ warning(monitor, "ReferenceIncompatibleInterface",
composite,
composite.getName().toString(),
componentReference.getName(),
@@ -668,14 +667,16 @@
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 @@
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 @@
*/
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 @@
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 @@
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 @@
//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 @@
}
- 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 @@
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 @@
PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentService, null);
} catch ( Exception e ) {
- error("PolicyRelatedException", componentService, e);
+ error(monitor, "PolicyRelatedException", componentService, e);
//throw new RuntimeException(e);
}
}
@@ -1063,7 +1065,7 @@
false);
}
} catch ( Exception e ) {
- error("PolicyRelatedException", componentReference, e);
+ error(monitor, "PolicyRelatedException", componentReference, e);
//throw new RuntimeException(e);
}
}
@@ -1083,7 +1085,7 @@
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 @@
PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(reference);
PolicyConfigurationUtil.determineApplicableBindingPolicySets(reference, null);
} catch ( Exception e ) {
- error("PolicyRelatedException", reference, e);
+ error(monitor, "PolicyRelatedException", reference, e);
//throw new RuntimeException(e);
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -41,28 +41,28 @@
@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);
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -27,6 +27,7 @@
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 @@
* @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 @@
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
- buildReferenceBindings((Composite)implementation);
+ buildReferenceBindings((Composite)implementation, monitor);
}
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -35,6 +35,7 @@
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 @@
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 @@
* @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);
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -24,6 +24,7 @@
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 @@
*/
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);
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -24,11 +24,11 @@
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 @@
* @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);
}
}
Modified: tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java?rev=702000&r1=701999&r2=702000&view=diff
==============================================================================
--- tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java (original)
+++ tuscany/branches/sca-equinox/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java Mon Oct 6 01:32:38 2008
@@ -28,6 +28,8 @@
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 @@
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);