summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-08-18 14:27:28 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-08-18 14:27:28 +0000
commita08ed65533ef649c2d56c0289c911a70a1780c12 (patch)
treeb1e4b9e99bb97bc0a106393452a34b8ebedc9ddd /java/sca/modules/assembly
parentf982a2adf063ab980e2050b43121a04cea748638 (diff)
Change no component reference target warning to error (ASM_6020). Push some context into the monitor.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@805425 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java107
1 files changed, 64 insertions, 43 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
index 9f14df547f..4019a6eed2 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
@@ -80,50 +80,62 @@ public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderI
private void processComponentReferences(Composite composite) {
- // index all of the components in the composite
- Map<String, Component> components = new HashMap<String, Component>();
- indexComponents(composite, components);
-
- // index all of the services in the composite
- Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
- indexServices(composite, componentServices);
-
- // create endpoint references for each component's references
- for (Component component : composite.getComponents()) {
-
- if (useNew) {
- for (ComponentReference reference : component.getReferences()) {
- createReferenceEndpointReferences2(composite, component, reference, components, componentServices);
- } // end for
- }
-
- // recurse for composite implementations
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- processComponentReferences((Composite)implementation);
- }
-
- // create endpoint references to represent the component reference
- for (ComponentReference reference : component.getReferences()) {
-
- if (!useNew) {
- createReferenceEndpointReferences(composite, component, reference, components, componentServices);
- } // end if
-
- // fix up links between endpoints and endpoint references that represent callbacks
- for (ComponentService service : component.getServices()) {
- if ((service.getInterfaceContract() != null) && (service.getInterfaceContract()
- .getCallbackInterface() != null)) {
- if (reference.getName().equals(service.getName())) {
- for (Endpoint endpoint : service.getEndpoints()) {
- endpoint.getCallbackEndpointReferences().addAll(reference.getEndpointReferences());
- }
- break;
+ monitor.pushContext("Composite: " + composite.getName().toString());
+
+ try {
+ // index all of the components in the composite
+ Map<String, Component> components = new HashMap<String, Component>();
+ indexComponents(composite, components);
+
+ // index all of the services in the composite
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ indexServices(composite, componentServices);
+
+ // create endpoint references for each component's references
+ for (Component component : composite.getComponents()) {
+ monitor.pushContext("Component: " + component.getName());
+
+ try {
+ if (useNew) {
+ for (ComponentReference reference : component.getReferences()) {
+ createReferenceEndpointReferences2(composite, component, reference, components, componentServices);
+ } // end for
+ }
+
+ // recurse for composite implementations
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ processComponentReferences((Composite)implementation);
+ }
+
+ // create endpoint references to represent the component reference
+ for (ComponentReference reference : component.getReferences()) {
+
+ if (!useNew) {
+ createReferenceEndpointReferences(composite, component, reference, components, componentServices);
} // end if
- } // end if
- } // end for
+
+ // fix up links between endpoints and endpoint references that represent callbacks
+ for (ComponentService service : component.getServices()) {
+ if ((service.getInterfaceContract() != null) && (service.getInterfaceContract()
+ .getCallbackInterface() != null)) {
+ if (reference.getName().equals(service.getName())) {
+ for (Endpoint endpoint : service.getEndpoints()) {
+ endpoint.getCallbackEndpointReferences().addAll(reference.getEndpointReferences());
+ }
+ break;
+ } // end if
+ } // end if
+ } // end for
+ } // end for
+
+ } finally {
+ monitor.popContext();
+ }
} // end for
- } // end for
+ } finally {
+ monitor.popContext();
+ }
} // end method processCompoenntReferences
private void createReferenceEndpointReferences(Composite composite,
@@ -131,6 +143,9 @@ public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderI
ComponentReference reference,
Map<String, Component> components,
Map<String, ComponentService> componentServices) {
+
+ monitor.pushContext("Reference: " + reference.getName());
+
// Get reference targets
List<ComponentService> refTargets = getReferenceTargets(reference);
if (reference.getAutowire() == Boolean.TRUE && reference.getTargets().isEmpty()) {
@@ -163,7 +178,11 @@ public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderI
if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
if (reference.getEndpointReferences().size() == 0) {
- warning(monitor, "NoComponentReferenceTarget", reference, reference.getName());
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "NoComponentReferenceTarget",
+ reference.getName());
}
}
@@ -370,6 +389,8 @@ public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderI
}
}
+ monitor.popContext();
+
} // end method
/**