use of alma.cdbErrType.wrappers.AcsJCDBRecordAlreadyExistsEx in project ACS by ACS-Community.
the class WDALImpl method add_node.
/**
* Adds a new node specified by curl to the CDB initially filed with
*
* @param curl uri for the CDB node
* @param xml
*
* @throws CDBRecordAlreadyExistsEx
* @throws CDBXMLErrorEx
* @throws CDBExceptionEx
*/
public void add_node(String curl, String xml) throws CDBRecordAlreadyExistsEx, CDBXMLErrorEx, CDBExceptionEx {
dalImpl.totalDALInvocationCounter.incrementAndGet();
logger.log(AcsLogLevel.INFO, "add_node " + curl);
// check if node is already there
if (nodeExists(curl)) {
logger.log(AcsLogLevel.NOTICE, "Record already exists: " + curl);
AcsJCDBRecordAlreadyExistsEx e2 = new AcsJCDBRecordAlreadyExistsEx();
e2.setCurl(curl);
e2.log(logger);
throw e2.toCDBRecordAlreadyExistsEx();
}
// check that suplied xml is valid
try {
validateXML(xml);
} catch (AcsJCDBXMLErrorEx e) {
e.log(logger);
throw e.toCDBXMLErrorEx();
}
// recreate dir structure and put data content
getNodeFile(curl).getParentFile().mkdirs();
try {
// write content
writeXmlData(curl, xml);
} catch (AcsJCDBExceptionEx e) {
throw e.toCDBExceptionEx();
}
}
Aggregations