* if an error occurs during type priority setup
*/
public static void setupTypePriorities(CASMgr aCASMgr, TypePriorities aTypePriorities)
throws ResourceInitializationException {
if (aTypePriorities != null) {
LinearTypeOrderBuilder typeOrderBuilder = aCASMgr.getIndexRepositoryMgr()
.getDefaultOrderBuilder();
TypePriorityList[] priorityLists = aTypePriorities.getPriorityLists();
for (int i = 0; i < priorityLists.length; i++) {
// check that all types exist. This error would be caught in
// typeOrderBuilder.getOrder(), but that's too late to indicate
// the location of the faulty descriptor in the error message.
String[] typeList = priorityLists[i].getTypes();
for (int j = 0; j < typeList.length; j++) {
if (aCASMgr.getTypeSystemMgr().getType(typeList[j]) == null) {
throw new ResourceInitializationException(
ResourceInitializationException.UNDEFINED_TYPE_FOR_PRIORITY_LIST, new Object[] {
typeList[j], priorityLists[i].getSourceUrlString() });
}
}
try {
typeOrderBuilder.add(priorityLists[i].getTypes());
} catch (CASException e) {
// typically caused by a cycle in the priorities - the caused-by message
// will clarify.
throw new ResourceInitializationException(
ResourceInitializationException.INVALID_TYPE_PRIORITIES,