From 77738b4c5dbfa1944308fe786f5a7fbff05a024a Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 25 Sep 2009 21:15:31 +0000 Subject: Comment out the incorrect policy matching algorithm and enable itest/policies git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@819013 13f79535-47bb-0310-9956-ffa450edef68 --- .../builder/impl/CompositePolicyBuilderImpl.java | 35 ++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'java/sca/modules/assembly') diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java index 4f16988fe8..b79a9a9ad5 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java @@ -87,15 +87,17 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo * Check if two policy subjects requires multually exclusive intents * @param subject1 * @param subject2 + * @param monitor * @return */ - private boolean isMutualExclusive(PolicySubject subject1, PolicySubject subject2) { + private boolean checkMutualExclusion(PolicySubject subject1, PolicySubject subject2, Monitor monitor) { if (subject1 == subject2 || subject1 == null || subject2 == null) { return false; } for (Intent i1 : subject1.getRequiredIntents()) { for (Intent i2 : subject1.getRequiredIntents()) { if (i1.getExcludedIntents().contains(i2) || i2.getExcludedIntents().contains(i1)) { + error(monitor, "MutuallyExclusiveIntents", new Object[] {subject1, subject2}, i1, i2); return true; } } @@ -206,7 +208,7 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo if (resolved != null) { intents.add(resolved); } else { - warning(monitor, "intent-not-found", subject, i.getName().toString()); + warning(monitor, "IntentNotFound", subject, i); // Intent cannot be resolved } } @@ -297,16 +299,17 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo } for (Component component : composite.getComponents()) { - isMutualExclusive(component, component.getImplementation()); + checkMutualExclusion(component, component.getImplementation(), monitor); for (ComponentService componentService : component.getServices()) { - isMutualExclusive(componentService, componentService.getService()); + checkMutualExclusion(componentService, componentService.getService(), monitor); if (componentService.getInterfaceContract() != null && componentService.getService() != null) { - isMutualExclusive(componentService.getInterfaceContract().getInterface(), componentService - .getService().getInterfaceContract().getInterface()); - isMutualExclusive(componentService.getInterfaceContract().getCallbackInterface(), componentService - .getService().getInterfaceContract().getCallbackInterface()); + checkMutualExclusion(componentService.getInterfaceContract().getInterface(), componentService + .getService().getInterfaceContract().getInterface(), monitor); + checkMutualExclusion(componentService.getInterfaceContract().getCallbackInterface(), + componentService.getService().getInterfaceContract().getCallbackInterface(), + monitor); } for (Endpoint ep : componentService.getEndpoints()) { @@ -324,7 +327,7 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo if (componentService.getService() != null) { for (Binding binding : componentService.getService().getBindings()) { if (isEqual(ep.getBinding().getName(), binding.getName()) && (binding instanceof PolicySubject)) { - isMutualExclusive((PolicySubject)ep.getBinding(), (PolicySubject)binding); + checkMutualExclusion((PolicySubject)ep.getBinding(), (PolicySubject)binding, monitor); // Inherit from componentType.service.binding inherit(ep, binding); break; @@ -345,13 +348,15 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo } for (ComponentReference componentReference : component.getReferences()) { - isMutualExclusive(componentReference, componentReference.getReference()); + checkMutualExclusion(componentReference, componentReference.getReference(), monitor); if (componentReference.getInterfaceContract() != null && componentReference.getReference() != null) { - isMutualExclusive(componentReference.getInterfaceContract().getInterface(), componentReference - .getReference().getInterfaceContract().getInterface()); - isMutualExclusive(componentReference.getInterfaceContract().getCallbackInterface(), - componentReference.getReference().getInterfaceContract().getCallbackInterface()); + checkMutualExclusion(componentReference.getInterfaceContract().getInterface(), componentReference + .getReference().getInterfaceContract().getInterface(), monitor); + checkMutualExclusion(componentReference.getInterfaceContract().getCallbackInterface(), + componentReference.getReference().getInterfaceContract() + .getCallbackInterface(), + monitor); } for (EndpointReference epr : componentReference.getEndpointReferences()) { @@ -371,7 +376,7 @@ public class CompositePolicyBuilderImpl extends BaseBuilderImpl implements Compo for (Binding binding : componentReference.getReference().getBindings()) { if (epr.getBinding() != null && isEqual(epr.getBinding().getName(), binding.getName()) && (binding instanceof PolicySubject)) { - isMutualExclusive((PolicySubject)epr.getBinding(), (PolicySubject)binding); + checkMutualExclusion((PolicySubject)epr.getBinding(), (PolicySubject)binding, monitor); // Inherit from componentType.reference.binding inherit(epr, binding); break; -- cgit v1.2.3