parsingMsg = e.getMessage();
//catch the xml parsers exception,
//transform it into YAWL format and abort the load
for (StringTokenizer tokens = new StringTokenizer(parsingMsg, "\n"); tokens.hasMoreTokens();) {
String msg = tokens.nextToken();
errorMessages.add(new YVerificationMessage(null, msg, YVerificationMessage.ERROR_STATUS));
}
logger.debug("<-- addSpecifcations: syntax exceptions found");
return returnIDs;
} catch (YSchemaBuildingException e) {
logger.error("Could not build schema.", e);
e.printStackTrace();
return null;
}
for (Iterator iterator = newSpecifications.iterator(); iterator.hasNext();) {
YSpecification specification = (YSpecification) iterator.next();
List messages = specification.verify();
if (messages.size() > 0 && !ignoreErors) {
YMessagePrinter.printMessages(messages);
errorMessages.addAll(messages);
}
//if the error messages are empty or contain only warnings
if (YVerificationMessage.containsNoErrors(errorMessages)) {
boolean success = loadSpecification(specification);
if (success) {
/*
INSERTED FOR PERSISTANCE
*/
if (!restoring) {
logger.info("Persisting specification loaded from file " + specificationFile.getAbsolutePath());
YSpecFile yspec = new YSpecFile(specificationFile.getAbsolutePath());
if (journalising) {
YPersistenceManager pmgr = new YPersistenceManager(getPMSessionFactory());
try {
pmgr.startTransactionalSession();
pmgr.storeObject(yspec);
pmgr.commit();
} catch (YPersistenceException e) {
throw new YPersistenceException("Failrue whilst persisting new specification", e);
}
}
}
/******************/
returnIDs.add(specification.getID());
} else {//the user has loaded the specification with identical id
errorMessages.add(new YVerificationMessage(this,
"There is a specification with an identical id to ["
+ specification.getID() + "] already loaded into the engine.",
YVerificationMessage.ERROR_STATUS));
}
}