public void handleXML(OperationContext context, Node root, XPath xpath)
throws Exception {
// initialize
LOGGER.finer("Handling csw:Transaction request XML...");
TransactionOptions tOptions = context.getRequestOptions().getTransactionOptions();
ServiceProperties svcProps = context.getServiceProperties();
ParseHelper pHelper = new ParseHelper();
ValidationHelper vHelper = new ValidationHelper();
String locator;
String[] parsed;
ISupportedValues supported;
NodeList nlActions;
IOperationProvider opProvider = null;
// service and version are parsed by the parent RequestHandler
// output format
locator = "@outputFormat";
parsed = pHelper.getParameterValues(root,xpath,locator);
supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
context.getOperationResponse().setOutputFormat(
vHelper.validateValue(supported,locator,parsed,false));
// verbose response
locator = "@verboseResponse";
parsed = pHelper.getParameterValues(root,xpath,locator);
supported = new SupportedValues("true,false",",");
String verbose = Val.chkStr(vHelper.validateValue(supported,locator,parsed,false));
tOptions.setVerboseResponse(verbose.equalsIgnoreCase("true"));
// request ID
locator = "@requestId";
parsed = pHelper.getParameterValues(root,xpath,locator);
tOptions.setRequestId(vHelper.validateValue(locator,parsed,false));
// determine the sub-operation
// Insert
if (opProvider == null) {
locator = "csw:Insert";
nlActions = (NodeList)xpath.evaluate(locator,root,XPathConstants.NODESET);
if ((nlActions != null) && (nlActions.getLength() > 0)) {
tOptions.setTransactionType(CswConstants.TransactionType_Insert);
opProvider = new InsertProvider();
}
}
// Update
if (opProvider == null) {
locator = "csw:Update";
nlActions = (NodeList)xpath.evaluate(locator,root,XPathConstants.NODESET);
if ((nlActions != null) && (nlActions.getLength() > 0)) {
tOptions.setTransactionType(CswConstants.TransactionType_Update);
opProvider = new UpdateProvider();
}
}
// Delete
if (opProvider == null) {
locator = "csw:Delete";
nlActions = (NodeList)xpath.evaluate(locator,root,XPathConstants.NODESET);
if ((nlActions != null) && (nlActions.getLength() > 0)) {
tOptions.setTransactionType(CswConstants.TransactionType_Delete);
opProvider = new DeleteProvider();
}
}
// handle the sub-operation