String qualifierName = null;
String qualfiedIntentName = null;
Intent qualifiedIntent = null;
Qualifier qualifier = null;
int event = reader.getEventType();
try {
reader.next();
while (reader.hasNext()) {
event = reader.getEventType();
switch (event) {
case START_ELEMENT: {
name = reader.getName();
if (POLICY_INTENT_MAP_QUALIFIER_QNAME.equals(name)) {
qualifierName = getString(reader, NAME);
if (qualifierName != null) {
qualfiedIntentName =
mappedIntent.getName().getLocalPart() + QUALIFIER + qualifierName;
qualifiedIntent = policyFactory.createIntent();
qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
qualfiedIntentName));
qualifier = policyFactory.createQualifier();
qualifier.setIntent(qualifiedIntent);
intentMap.getQualifiers().add(qualifier);
} else {
error("QualifierNameMissing", reader, policySet.getName());
}
} else if (POLICY_INTENT_MAP_QNAME.equals(name)) {
QName providedIntent = getQName(reader, PROVIDES);
if (qualifierName.equals(providedIntent.getLocalPart())) {
readIntentMap(reader, policySet, qualifiedIntent);
} else {
error("IntentMapDoesNotMatch",
providedIntent,
providedIntent,
qualifierName,
policySet);
//throw new ContributionReadException("Intent provided by IntentMap " +
//providedIntent + " does not match parent qualifier " + qualifierName +
//" in policyset - " + policySet);
}
} else {
Object extension = extensionProcessor.read(reader);
if (extension != null && qualifier != null) {
PolicyExpression exp = policyFactory.createPolicyExpression();
exp.setName(name);
exp.setPolicy(extension);
qualifier.getPolicies().add(exp);
}
}
break;
}
}