diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2012-03-23 17:24:36 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2012-03-23 17:24:36 +0000 |
commit | 2b658cba22046ff1deee29562fe073bcabe4cdc0 (patch) | |
tree | 0d398a0ea9a9c7df61dd2b473c3b388c640bab07 /sca-java-2.x/trunk/modules/builder | |
parent | 49de8e6978a137718c71c99b00f4f48440f9e9ab (diff) |
TUSCANY-4031 - apply patch for IntentNotSatisfiedAtBuild warning when reference uses an intent provided by binding. Thanks for the patch Greg.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1304507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/builder')
-rw-r--r-- | sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java index dab5fb3d5e..cbade8d520 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java @@ -539,40 +539,37 @@ public class ComponentPolicyBuilderImpl { } if (!intentMatched){ - - // Reference side intents can still be resolved by the service binding, so we can only issue a - // warning here. - if ( subject instanceof EndpointReference ) { - warning(context.getMonitor(), "IntentNotSatisfiedAtBuild", subject, intent.getName(), subject.toString()); - } else { - // Need to check the ExtensionType to see if the intent is provided there. If not, throw an error - ExtensionType type = subject.getExtensionType(); - - - if ( type == null ) { - error(context.getMonitor(), "IntentNotSatisfiedAtBuild", subject, intent.getName(), subject.toString()); - } else { - // The ExtensionType on the subject only has the binding name. The one in the system - // definitions will have the mayProvide/alwaysProvides values - if (type.getType().getLocalPart().startsWith("implementation")) { - for ( ExtensionType et : context.getDefinitions().getImplementationTypes() ) { - if ( type.getType().equals(et.getType()) ) { - type = et; - } - } - } else { - for ( ExtensionType et : context.getDefinitions().getBindingTypes() ) { - if ( type.getType().equals(et.getType()) ) { - type = et; - } - } - } - - if ( !type.getAlwaysProvidedIntents().contains(intent) && !type.getMayProvidedIntents().contains(intent)) { - error(context.getMonitor(), "IntentNotSatisfiedAtBuild", subject, intent.getName(), subject.toString()); - } - } - } + + // Need to check the ExtensionType to see if the intent is provided there. If not, throw an error + ExtensionType type = subject.getExtensionType(); + + if ( type != null ) { + // The ExtensionType on the subject only has the binding name. The one in the system + // definitions will have the mayProvide/alwaysProvides values + if (type.getType().getLocalPart().startsWith("implementation")) { + for ( ExtensionType et : context.getDefinitions().getImplementationTypes() ) { + if ( type.getType().equals(et.getType()) ) { + type = et; + } + } + } else { + for ( ExtensionType et : context.getDefinitions().getBindingTypes() ) { + if ( type.getType().equals(et.getType()) ) { + type = et; + } + } + } + } + + if ( type == null || !type.getAlwaysProvidedIntents().contains(intent) && !type.getMayProvidedIntents().contains(intent)) { + // Reference side intents can still be resolved by the service binding, so we can only issue a + // warning here. + if ( subject instanceof EndpointReference ) { + warning(context.getMonitor(), "IntentNotSatisfiedAtBuild", subject, intent.getName(), subject.toString()); + } else { + error(context.getMonitor(), "IntentNotSatisfiedAtBuild", subject, intent.getName(), subject.toString()); + } + } } } } |