summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-01-18 20:44:02 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-01-18 20:44:02 +0000
commit74e7c014ea9d312fef584694bbfa64154b76ab68 (patch)
tree7df772bb6851784c59c7169f8066c426f6aad6ed /sca-java-2.x
parentb664cc0845f305e213e52e469604390be2deea23 (diff)
Check that all policies in a given policy set are expressed in a single language.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@900546 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java15
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties1
-rw-r--r--sca-java-2.x/trunk/modules/policy-wspolicy/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder17
3 files changed, 32 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
index ed62e0a406..c1513d9306 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
@@ -217,7 +217,20 @@ public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StA
PolicyExpression exp = policyFactory.createPolicyExpression();
exp.setName(name);
exp.setPolicy(extension);
- policySet.getPolicies().add(exp);
+ // check that all the policies in the policy set are
+ // expressed in the same language. Compare against the
+ // first expression we added
+ if ((policySet.getPolicies().size() > 0) &&
+ (!policySet.getPolicies().get(0).getName().equals(name))){
+ error(monitor,
+ "PolicyLanguageMissmatch",
+ reader,
+ policySet.getName(),
+ policySet.getPolicies().get(0).getName(),
+ name);
+ } else {
+ policySet.getPolicies().add(exp);
+ }
}
}
break;
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties b/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
index b61f004b32..94f98f5580 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/policy/xml/policy-xml-validation-messages.properties
@@ -47,3 +47,4 @@ QualifierIsNotUnique = [POL30005] The intent {0} has more than one qualifier wit
ProfileIntentNameWithPeriod = [POL30006] The profile intent name {0} must not have the character "." in it
IntentMapIsNotUnique = [POL30010] The policy set {0} has more than one intent map with the name {1}
IntentMapMissingQualifiers = [POL30020] The policy set {0} intent map {1} has missing qualifiers: {2} The intent map qualifiers must match the provided intent qualifiers.
+PolicyLanguageMissmatch = Policy set {0} contains policy expressions from more than on language, languages {1} and {2} found
diff --git a/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder b/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder
new file mode 100644
index 0000000000..e161411be3
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.builder.PolicyBuilder
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.apache.tuscany.sca.policy.wspolicy.WSPolicyBuilder;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#Policy