summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/builder/src/main
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-05 13:14:17 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-05 13:14:17 +0000
commit89e8211b2b8ddb262dffbd2dc338a6fa7d4c140b (patch)
tree17f273a484ac5035f385d2ed998f0e1333fe2d22 /java/sca/modules/builder/src/main
parent77a3fbf56b71926c91891087ad70220c964ed59b (diff)
Add back in duplicate name checking that got lost during the re-org.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@821787 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.java61
1 files changed, 61 insertions, 0 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 3b3560e46f..17c1db038c 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
@@ -176,6 +176,7 @@ public class ComponentBuilderImpl {
// look at each component service in turn and calculate its
// configuration based on OASIS rules
for (ComponentService componentService : component.getServices()) {
+
Service componentTypeService = componentService.getService();
if (componentTypeService == null) {
@@ -308,6 +309,16 @@ public class ComponentBuilderImpl {
// Create a component service for each service
if (component.getImplementation() != null) {
for (Service service : component.getImplementation().getServices()) {
+ // check for duplicate service names in implementation
+ if (service != component.getImplementation().getService(service.getName())){
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateImplementationServiceName",
+ component.getName(),
+ service.getName());
+ }
+
ComponentService componentService = (ComponentService)component.getService(service.getName());
// if the component doesn't have a service with the same name as the
@@ -328,6 +339,16 @@ public class ComponentBuilderImpl {
// Create a component reference for each reference
if (component.getImplementation() != null) {
for (Reference reference : component.getImplementation().getReferences()) {
+ // check for duplicate reference names in implementation
+ if (reference != component.getImplementation().getReference(reference.getName())){
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateImplementationReferenceName",
+ component.getName(),
+ reference.getName());
+ }
+
ComponentReference componentReference = (ComponentReference)component.getReference(reference.getName());
// if the component doesn't have a reference with the same name as the
@@ -348,6 +369,15 @@ public class ComponentBuilderImpl {
// Create component property for each property
if (component.getImplementation() != null) {
for (Property property : component.getImplementation().getProperties()) {
+ // check for duplicate property names in implementation
+ if (property != component.getImplementation().getProperty(property.getName())){
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateImplementationPropertyName",
+ component.getName(),
+ property.getName());
+ }
ComponentProperty componentProperty = (ComponentProperty)component.getProperty(property.getName());
// if the component doesn't have a property with the same name as
@@ -371,6 +401,16 @@ public class ComponentBuilderImpl {
// Connect each component service to the corresponding component type service
for (ComponentService componentService : component.getServices()) {
+ // check for duplicate service names in component
+ if (componentService != component.getService(componentService.getName())){
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateComponentServiceName",
+ component.getName(),
+ componentService.getName());
+ }
+
if (componentService.getService() != null || componentService.isForCallback()) {
continue;
}
@@ -399,6 +439,16 @@ public class ComponentBuilderImpl {
// Connect each component reference to the corresponding component type reference
for (ComponentReference componentReference : component.getReferences()) {
+ // check for duplicate reference names in component
+ if (componentReference != component.getReference(componentReference.getName())){
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateComponentReferenceName",
+ component.getName(),
+ componentReference.getName());
+ }
+
if (componentReference.getReference() != null || componentReference.isForCallback()) {
continue;
}
@@ -426,7 +476,18 @@ public class ComponentBuilderImpl {
private void connectPropertiesToComponentType(Component component) {
// Connect each component property to the corresponding component type property
for (ComponentProperty componentProperty : component.getProperties()) {
+ // check for duplicate property names in component
+ if (componentProperty != component.getProperty(componentProperty.getName())){
+ Monitor.error(monitor,
+ this,
+ "assembly-validation-messages",
+ "DuplicateComponentPropertyName",
+ component.getName(),
+ componentProperty.getName());
+ }
+
Property property = component.getImplementation().getProperty(componentProperty.getName());
+
if (property != null) {
componentProperty.setProperty(property);
} else {