}
else
{
if (WorkManagerSecurity.Tag.forName(reader.getLocalName()) == WorkManagerSecurity.Tag.UNKNOWN)
{
throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
}
case START_ELEMENT : {
switch (WorkManagerSecurity.Tag.forName(reader.getLocalName()))
{
case DEFAULT_GROUPS :
case MAPPINGS : {
// Skip
break;
}
case MAPPING_REQUIRED : {
mappingRequired = elementAsBoolean(reader);
break;
}
case DOMAIN : {
domain = elementAsString(reader);
break;
}
case DEFAULT_PRINCIPAL : {
defaultPrincipal = elementAsString(reader);
break;
}
case GROUP : {
if (defaultGroups == null)
defaultGroups = new ArrayList<String>(1);
defaultGroups.add(elementAsString(reader));
break;
}
case USERS : {
userMappingEnabled = true;
break;
}
case GROUPS : {
userMappingEnabled = false;
break;
}
case MAP : {
if (userMappingEnabled)
{
if (userMappings == null)
userMappings = new HashMap<String, String>();
String from = attributeAsString(reader, WorkManagerSecurity.Attribute.FROM.getLocalName());
if (from == null || from.trim().equals(""))
throw new ParserException(
bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.FROM.getLocalName(),
reader.getLocalName()));
String to = attributeAsString(reader, WorkManagerSecurity.Attribute.TO.getLocalName());
if (to == null || to.trim().equals(""))
throw new ParserException(
bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.TO.getLocalName(),
reader.getLocalName()));
userMappings.put(from, to);
}
else
{
if (groupMappings == null)
groupMappings = new HashMap<String, String>();
String from = attributeAsString(reader, WorkManagerSecurity.Attribute.FROM.getLocalName());
if (from == null || from.trim().equals(""))
throw new ParserException(
bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.FROM.getLocalName(),
reader.getLocalName()));
String to = attributeAsString(reader, WorkManagerSecurity.Attribute.TO.getLocalName());
if (to == null || to.trim().equals(""))
throw new ParserException(
bundle.requiredAttributeMissing(WorkManagerSecurity.Attribute.TO.getLocalName(),
reader.getLocalName()));
groupMappings.put(from, to);
}
break;
}
default :
throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
throw new ParserException(bundle.unexpectedEndOfDocument());
}