summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/builder/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-05 15:21:01 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-05 15:21:01 +0000
commitb2442a41828e17feddfb119d0e35397f0a6aaa8e (patch)
treec7d81cb5dba9dd047d7701fa78491c795c70ba41 /java/sca/modules/builder/src/main
parent43655bfa4afe2d7faef2559f167850c664f5357c (diff)
Push/po context in the new component type and component builders
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@821835 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/builder/src/main')
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java88
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java98
2 files changed, 107 insertions, 79 deletions
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
index 17c1db038c..2272d3d1a5 100644
--- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
+++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
@@ -113,35 +113,41 @@ public class ComponentBuilderImpl {
*/
public void configureComponentFromComponentType(Component outerComponent, Composite parentComposite, Component component) {
- // do any work we need to do before we calculate the component type
- // for this component. Anything that needs to be pushed down the promotion
- // hierarchy must be done before we calculate the component type
-
- // first carry out any implementation specific builder processing
- Implementation impl = component.getImplementation();
- if (impl != null) {
- ImplementationBuilder builder = builders.getImplementationBuilder(impl.getClass());
- if (builder != null) {
- builder.build(component, impl, monitor);
+ monitor.pushContext("Component: " + component.getName().toString());
+
+ try {
+ // do any work we need to do before we calculate the component type
+ // for this component. Anything that needs to be pushed down the promotion
+ // hierarchy must be done before we calculate the component type
+
+ // first carry out any implementation specific builder processing
+ Implementation impl = component.getImplementation();
+ if (impl != null) {
+ ImplementationBuilder builder = builders.getImplementationBuilder(impl.getClass());
+ if (builder != null) {
+ builder.build(component, impl, monitor);
+ }
}
- }
-
- // Properties on the composite component type are not affected by the components
- // that the composite contains. Instead the child components might source
- // composite level property values. Hence we have to calculate whether the component
- // type property value should be overridden by this component's property value
- // before we go ahead and calculate the component type
- configureProperties(outerComponent, parentComposite, component);
-
- // create the component type for this component
- // taking any nested composites into account
- createComponentType(component);
-
- // configure services based on the calculated component type
- configureServices(component);
-
- // configure services based on the calculated component type
- configureReferences(component);
+
+ // Properties on the composite component type are not affected by the components
+ // that the composite contains. Instead the child components might source
+ // composite level property values. Hence we have to calculate whether the component
+ // type property value should be overridden by this component's property value
+ // before we go ahead and calculate the component type
+ configureProperties(outerComponent, parentComposite, component);
+
+ // create the component type for this component
+ // taking any nested composites into account
+ createComponentType(component);
+
+ // configure services based on the calculated component type
+ configureServices(component);
+
+ // configure services based on the calculated component type
+ configureReferences(component);
+ } finally {
+ monitor.popContext();
+ }
}
/**
@@ -290,7 +296,7 @@ public class ComponentBuilderImpl {
// configure the property value based on the @source attribute
// At the moment this is done in the parent composite component
- // type calculation a
+ // type calculation
processPropertySourceAttribute(outerComponent, parentComposite, component, componentProperty);
// configure the property value based on the @file attribute
@@ -298,8 +304,12 @@ public class ComponentBuilderImpl {
// Check that a value is supplied
if (componentProperty.isMustSupply() && !isPropertyValueSet(componentProperty)) {
- Monitor.error(monitor, this, "assembly-validation-messages", "PropertyMustSupplyNull", component
- .getName(), componentProperty.getName());
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "PropertyMustSupplyNull",
+ component.getName(),
+ componentProperty.getName());
}
}
}
@@ -553,8 +563,12 @@ public class ComponentBuilderImpl {
// Check that a component property does not override the
// many attribute
if (!componentTypeProperty.isMany() && componentProperty.isMany()) {
- Monitor.error(monitor, this, "assembly-validation-messages", "PropertyOverrideManyAttribute", component
- .getName(), componentProperty.getName());
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "PropertyOverrideManyAttribute",
+ component.getName(),
+ componentProperty.getName());
}
// Default to the many attribute defined on the property
@@ -570,8 +584,12 @@ public class ComponentBuilderImpl {
// Check that a type or element are specified
if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
- Monitor.error(monitor, this, "assembly-validation-messages", "NoTypeForComponentProperty", component
- .getName(), componentProperty.getName());
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "NoTypeForComponentProperty",
+ component.getName(),
+ componentProperty.getName());
}
}
}
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java
index b02c3ca68f..4be688ae3b 100644
--- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java
+++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java
@@ -96,51 +96,61 @@ public class CompositeComponentTypeBuilderImpl {
*/
public void createComponentType(Component outerComponent, Composite composite) {
- // first make sure that each child component has been properly configured based
- // on its own component type
- for (Component component : composite.getComponents()) {
-
- // Check for duplicate component names
- if (composite.getComponent(component.getName()) == null) {
- Monitor.error(monitor, this, "assembly-validation-messages", "DuplicateComponentName", composite
- .getName().toString(), component.getName());
- }
-
- // do any work we need to do before we configure the component
- // Anything that needs to be pushed down the promotion
- // hierarchy must be done before we configure the component
-
- // Push down the autowire flag from the composite to components
- if (component.getAutowire() == null) {
- component.setAutowire(composite.getAutowire());
+ monitor.pushContext("Composite: " + composite.getName().toString());
+
+ try {
+ // first make sure that each child component has been properly configured based
+ // on its own component type
+ for (Component component : composite.getComponents()) {
+
+ // Check for duplicate component names
+ if (composite.getComponent(component.getName()) == null) {
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateComponentName",
+ composite.getName().toString(),
+ component.getName());
+ }
+
+ // do any work we need to do before we configure the component
+ // Anything that needs to be pushed down the promotion
+ // hierarchy must be done before we configure the component
+
+ // Push down the autowire flag from the composite to components
+ if (component.getAutowire() == null) {
+ component.setAutowire(composite.getAutowire());
+ }
+
+ // configure the component from its component type
+ componentBuilder.configureComponentFromComponentType(outerComponent, composite, component);
}
-
- // configure the component from its component type
- componentBuilder.configureComponentFromComponentType(outerComponent, composite, component);
- }
-
- // create the composite component type based on the promoted artifacts
- // from the components that it contains
-
- // index all the components, services and references in the
- // component type so that they are easy to find
- Map<String, Component> components = new HashMap<String, Component>();
- Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
- Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
- indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
-
- // services
- calculateServices(composite, components, componentServices);
-
- // references
- calculateReferences(composite, components, componentReferences);
-
- // properties
- // Properties on the composite component are unaffected by properties
- // on child components. Instead child component properties might take their
- // values from composite properties. Hence there is nothing to do here.
- //calculateProperties(composite, components);
-
+
+ // create the composite component type based on the promoted artifacts
+ // from the components that it contains
+
+ // index all the components, services and references in the
+ // component type so that they are easy to find
+ Map<String, Component> components = new HashMap<String, Component>();
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+ indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
+
+ // services
+ calculateServices(composite, components, componentServices);
+
+ // references
+ calculateReferences(composite, components, componentReferences);
+
+ // properties
+ // Properties on the composite component are unaffected by properties
+ // on child components. Instead child component properties might take their
+ // values from composite properties. Hence there is nothing to do here.
+ //calculateProperties(composite, components);
+
+ } finally {
+ monitor.popContext();
+ }
}
/**