You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2012/03/23 18:24:36 UTC

svn commit: r1304507 - /tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java

Author: slaws
Date: Fri Mar 23 17:24:36 2012
New Revision: 1304507

URL: http://svn.apache.org/viewvc?rev=1304507&view=rev
Log:
TUSCANY-4031 - apply patch for IntentNotSatisfiedAtBuild warning when reference uses an intent provided by binding. Thanks for the patch Greg.

Modified:
    tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java?rev=1304507&r1=1304506&r2=1304507&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java Fri Mar 23 17:24:36 2012
@@ -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());
+                    }
+                }
             }
         }
     }