summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-02-21 19:52:18 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-02-21 19:52:18 +0000
commit3f90e370637330c034affe6cb89922bcdf265f77 (patch)
tree954bc4760a2a76c57c8005f08547002febb2b23b /java/sca/modules
parent99f810244bf4d4eb18f6c3830b5026ad35f205ea (diff)
Change the name from parent to qualifiableIntent for Intent model
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@746573 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java21
-rw-r--r--java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java2
-rw-r--r--java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java10
-rw-r--r--java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java4
-rw-r--r--java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java4
-rw-r--r--java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java4
6 files changed, 24 insertions, 21 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
index a51e353ddf..a7a40e62e6 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
@@ -21,9 +21,11 @@ package org.apache.tuscany.sca.assembly.builder.impl;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.xml.namespace.QName;
@@ -100,18 +102,15 @@ abstract class PolicyConfigurationUtil {
return inheritablePolicySets;
}
- private static void normalizePolicySets(PolicySubject policySetAttachPoint ) {
+ private static void normalizePolicySets(PolicySubject subject ) {
//get rid of duplicate entries
- HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
- for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
- policySetTable.put(policySet.getName(), policySet);
- }
+ Set<PolicySet> policySetTable = new HashSet<PolicySet>(subject.getPolicySets());
- policySetAttachPoint.getPolicySets().clear();
- policySetAttachPoint.getPolicySets().addAll(policySetTable.values());
+ subject.getPolicySets().clear();
+ subject.getPolicySets().addAll(policySetTable);
//expand profile intents
- for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ for ( PolicySet policySet : subject.getPolicySets() ) {
PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
}
}
@@ -196,9 +195,9 @@ abstract class PolicyConfigurationUtil {
Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
//if qualified form of intent exists remove the unqualified form
for ( Intent intent : intentsTableCopy.values() ) {
- if ( intent.getParent()!=null ) {
- if ( intentsTable.get(intent.getParent().getName()) != null ) {
- intentsTable.remove(intent.getParent().getName());
+ if ( intent.getQualifiableIntent()!=null ) {
+ if ( intentsTable.get(intent.getQualifiableIntent().getName()) != null ) {
+ intentsTable.remove(intent.getQualifiableIntent().getName());
}
}
}
diff --git a/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java b/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
index 69dedd2076..def310861a 100644
--- a/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
+++ b/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
@@ -168,7 +168,7 @@ public class ReadDocumentTestCase {
QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
Intent i2 = intentTable.get(confidentiality_transport);
- assertNotNull(i2.getParent());
+ assertNotNull(i2.getQualifiableIntent());
PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
diff --git a/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java b/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
index ffbceeaa12..d87921dbbf 100644
--- a/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
+++ b/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentProcessor.java
@@ -149,7 +149,7 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr
intent.setDefaultQualifiedIntent(qualified);
}
intent.getQualifiedIntents().add(qualified);
- qualified.setParent(intent);
+ qualified.setQualifiableIntent(intent);
current = qualified;
}
break;
@@ -171,6 +171,10 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr
reader.next();
}
}
+ // REVIEW: [rfeng] What's going to happen if there is only one qualified intent
+ if (intent.getQualifiedIntents().size() == 1) {
+ intent.setDefaultQualifiedIntent(intent.getQualifiedIntents().get(0));
+ }
return intent;
}
@@ -277,7 +281,7 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr
private void resolveQualifiedIntent(Intent qualifed, ModelResolver resolver) throws ContributionResolveException {
if (qualifed != null) {
//resolve the qualifiable intent
- Intent parent = qualifed.getParent();
+ Intent parent = qualifed.getQualifiableIntent();
if (parent == null) {
return;
}
@@ -288,7 +292,7 @@ public class IntentProcessor extends BaseStAXArtifactProcessor implements StAXAr
// Lets try to resolve them first.
if (!resolved.isUnresolved() || resolved != qualifed) {
- qualifed.setParent(resolved);
+ qualifed.setQualifiableIntent(resolved);
} else {
error("QualifiableIntentNotFound", resolver, parent, qualifed);
//throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
diff --git a/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
index 0e35d31f00..34e7e44939 100644
--- a/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
+++ b/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
@@ -203,7 +203,7 @@ public class ReadDocumentTestCase {
assertTrue(intentTable.get(confidentiality_transport) instanceof Intent);
Intent qualifiedIntent = (Intent)intentTable.get(new QName(namespace, "confidentiality.transport"));
assertNull(qualifiedIntent.getDescription());
- assertNotNull(qualifiedIntent.getParent().getDescription());
+ assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
@@ -253,7 +253,7 @@ public class ReadDocumentTestCase {
//testing if policy intents have been linked have property been linked up
assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
- assertNotNull(qualifiedIntent.getParent().getDescription());
+ assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
diff --git a/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java b/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
index 78ce04e9c9..b79ccdab78 100644
--- a/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
+++ b/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
@@ -140,13 +140,13 @@ public interface Intent {
* return null.
* @return The parent intent or null if this intent is not qualified
*/
- Intent getParent();
+ Intent getQualifiableIntent();
/**
* Set the parent intent for a qualified intent
* @param intent
*/
- void setParent(Intent intent);
+ void setQualifiableIntent(Intent intent);
boolean isUnresolved();
diff --git a/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java b/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
index 3c87c78af9..27a77f3ba8 100644
--- a/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
+++ b/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
@@ -72,11 +72,11 @@ public class IntentImpl implements Intent {
this.description = description;
}
- public Intent getParent() {
+ public Intent getQualifiableIntent() {
return parent;
}
- public void setParent(Intent parent) {
+ public void setQualifiableIntent(Intent parent) {
this.parent = parent;
}