Validate that the noListener intent isn't specified on a service
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@964321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9d256c2f1d
commit
cbbb016910
2 changed files with 18 additions and 1 deletions
|
@ -36,11 +36,13 @@ import org.apache.tuscany.sca.assembly.builder.BuilderContext;
|
|||
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
|
||||
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
|
||||
import org.apache.tuscany.sca.assembly.builder.PolicyBuilder;
|
||||
import org.apache.tuscany.sca.assembly.xml.Constants;
|
||||
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
|
||||
import org.apache.tuscany.sca.monitor.Monitor;
|
||||
import org.apache.tuscany.sca.policy.Intent;
|
||||
import org.apache.tuscany.sca.policy.PolicySet;
|
||||
import org.apache.tuscany.sca.policy.PolicySubject;
|
||||
import org.apache.tuscany.sca.policy.util.PolicyHelper;
|
||||
|
||||
/**
|
||||
* A composite builder that computes policy sets based on attached intents and policy sets.
|
||||
|
@ -126,6 +128,9 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple
|
|||
// Remove any direct policy sets if an external one has been applied
|
||||
removeDirectPolicySetsIfExternalExists(ep, context);
|
||||
|
||||
// Validate that noListener is not specified on a service endpoint
|
||||
checkForNoListenerIntent(ep, context);
|
||||
|
||||
// check that all intents are resolved
|
||||
checkIntentsResolved(ep, context);
|
||||
|
||||
|
@ -213,7 +218,18 @@ public class CompositePolicyBuilderImpl extends ComponentPolicyBuilderImpl imple
|
|||
}
|
||||
}
|
||||
|
||||
private void removeDirectPolicySetsIfExternalExists(PolicySubject subject,
|
||||
private void checkForNoListenerIntent(Endpoint ep, BuilderContext context) {
|
||||
PolicyHelper helper = new PolicyHelper();
|
||||
if ( helper.getIntent(ep, Constants.NOLISTENER_INTENT) != null ) {
|
||||
error(context.getMonitor(),
|
||||
"NoListenerIntentSpecifiedOnService",
|
||||
this,
|
||||
ep.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void removeDirectPolicySetsIfExternalExists(PolicySubject subject,
|
||||
BuilderContext context) {
|
||||
boolean foundExternalPolicySet = false;
|
||||
for (PolicySet ps : subject.getPolicySets() ) {
|
||||
|
|
|
@ -31,4 +31,5 @@ PolicySetNotFoundAtBuild = PolicySet {0} is not defined in SCA definitions
|
|||
IntentNotSatisfiedAtBuild = The intent {0} associated with policy subject {1} has no matching policy set
|
||||
MutuallyExclusiveIntentsAtBuild = [POL40009,ASM60009,ASM60010,JCA70001,JCA70003] Intent {0} and {1} are mutually exclusive
|
||||
IntentNotFoundAtBuild = Intent {0} is not defined in SCA definitions
|
||||
NoListenerIntentSpecifiedOnService = The noListener intent may only be specified on a reference.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue